Solved by 806 users: ...
` <  <  <  <  <  <  <  <  <  < `

## Circle Game

Time limit = 1

Let's consider circle game. From N children, numbered 1, 2, ..., N, standing in circle every M-th is going to be removed from circle and only the last child will be the winner. For example when N = 6 and M = 5 then the children will be removed in the order 5, 4, 6, 2, 3 and 1 will be winner.

There are two teams playing the game. Each team consists of K children. In the circle the first K children are from the first team and the last K children from the second one. You have to determine such minimal M that all the players of the second team will be removed before the children of the first team.

Input The input consists of one line, containing K. 0 < K < 14.

Output The output should contain M.

 Input#1```4 ``` Output#1```30 ```

Author:
Student olympiad in Khmelnitski, March 2003
24 april 2003

<PREV | Problem set | Search related messages | NEXT>

 © acm.mipt DevGroupThe page was generated in 200ms