|Online MIPT programming contest||РУССКИЙ|
Time limit = 1Let'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.
Student olympiad in Khmelnitski, March 2003
24 april 2003
© acm.mipt DevGroup
The page was generated in 250ms