P28160 [洛谷] Josephus
普及
题目描述

Problem Description

$n$ people stand in a circle, starting from a certain person, every $m$-th person is eliminated, and the counting restarts from the next person until only one remains. Now, there is a circle with $k$ good people standing together and $k$ bad people standing together. Counting starts from the first good person. You need to determine the smallest $m$ such that all $k$ bad people are eliminated before the first good person is killed.

Input Format

A single line containing an integer $k$.

Output Format

A single line containing an integer $m$.

Sample Input and Output

Sample Input #1

3

Sample Output #1

5

Sample Input #2

4

Sample Output #2

30

Notes

$0 < k < 14$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3
样例输出
5