cat

Felix the cat is taking his afternoon nap on Ioana's work table; she was just in the middle of solving Math problems. As if mesmerized by the harmony and beauty of numbers Felix dreams that there are N mice sitting in a circle around him, one white and the rest grey. The mice are numbered from 1 to N. The cat hears a voice he knows whispering in his ear: «Felix, you have to eat every k-th mouse! You will number them clockwise, starting with mouse x. You eat every k-th mouse and then you continue numbering them from the mouse that follows the one you ate! But be careful! You are not allowed to eat the white mouse; he has to be the last one left!»

Task

Write a program that helps Felix determine the number of the initial mouse so that, by eating every k-th mouse, he is left in the end with only the white mouse.

Input Data

Input file cat.in contains a single line with 3 positive integers each separated by a space, N, K and A, representing, in order, the number of mice, every which mouse is eliminated and the number of the white mouse.

Output Data

Output file cat.out will contain a single line with a positive integer, representing the smallest number of a mouse with which we can start the count so that only the white mouse is left in the end.

Constraints

3<= N <= 600
1<= K <=2*N
1<= A <=N

Examples

cat.in

cat.out

cat.in cat.out

Explanations

7 4 3

2

6 1 4 5

In the first example we start counting from mouse no. 2. The first mouse to be eliminated is mouse no. 5; we start counting from mouse no. 6 and the next one eliminated is no. 2, then 7, 6, 1, 4. The last one left is mouse no. 3. In the second example we start counting from mouse no. 5 and we eliminate one mouse at a time in the following order 5, 6, 1, 2, 3.

Time limit: 0.1 seconds/test

prof. Alin Burta
"B.P. Haşdeu" Buzău National High School
Contact: allbu2003@yahoo.com