403528: GYM101191 A Game with chocolates
Description
Peter and Vasya have birthdays at the same date. Perhaps, that is a reason why they were given the same boxes of chocolates. But it was too boring for friends just to eat these chocolates, so they decided to make a prize in the game from these chocolates.
The player for a one move is allowed to take from any box a number of chocolates such that there were less chocolates left than in the other box. Let after move in boxes left N and M chocolates (N > M). Then the number N - M must be non-negative i-th power of P (in other words N - M = Pi, i ≥ 0). And the integer part of a division N by the difference N - M should not be a multiple of P, or [N / (N - M)] mod P ≠ 0.
Parents love their children, so the number of chocolates in each of the boxes can be quite big and game could be delayed. That's why the guys would like to know if the initial configuration of chocolates (X chocolates in the Peter's box and Y in the Vasek's box) is advantageous for the player who will make the first move. Situation is advantageous, if it is possible to bring the game to at least one losing position, and the situation is losing, if it is impossible to bring the game into another losing position.
The player is a loser if he can't make the next move.
Find out the success of the initial situation in the game.
InputThere are three positive integers in the line: P (the difference should be a power of this number), X, Y (numbers of chocolates in the Peter's and Vasek's boxes respectively) (2 ≤ P, X, Y ≤ 1018).
OutputIn the first line you should write a message «NO», if the position is losing and «YES», if it is advantageous.
In the case of advantageous position you should write any of the following playing positions such that is losing.
ExamplesInput2 3 5Output
NOInput
3 3 3Output
YES
3 0