Consider a mathematical game in which two players take turns making moves. A natural number is given. On each turn, a player must decrease this number by a natural number that does not exceed , making sure the result remains non-negative. The player who cannot make a move loses. The value is chosen by the player who goes second. For the given , find the smallest possible value of that gives the second player a real chance to win, or output if it is not possible.
One number , N < 10^5.
One number – solution to the problem.
Example 1