Indicator
Losyash decided to take up running and for this purpose took a stopwatch from Pin. A few weeks later, Losyash became more athletic and began to do more than one lap at the stadium at a time. Then he ran into the classic problem of athletics: if you run long enough, you forget how many laps you have already run and how many you have left. Fortunately, there was a special indicator on the stopwatch that shows the current lap number. Now, every time, running through the finish line, Losyash pressed a special button on the stopwatch, and the number on the indicator increased by one.
What kind of indicator is this, you ask, that can display arbitrarily large positive integers? And it can't. The indicator is based on a gear with m teeth, on which positive integers from 1 to m are written, rotating when a button is pressed. Thus, if the number displayed by the indicator reaches m, and Losyash presses the button, then it is reset to one.
Once, after a run, Losyash remembered that Sovunya asked him to borrow a stopwatch so that she could cook Szechuan sauce exactly according to the recipe. Losyash simply loves this sauce, so he immediately went to Sovunya and decided, in addition, to please her and put on the indicator b - Sovunya's favorite number (it was so lucky that it was just a number from **1 ** to m, that is, the indicator was able to display it). At that moment, the indicator displayed the number a.
Losyash decided to press the button the least number of times so that the indicator would show the desired number. He was even too lazy to count the number of button presses he made. Therefore, this is for you to do.
Input
The first line contains an integer m (2 ≤ m ≤ 100) - the largest value that the indicator can display.
The second line contains an integer a (1 ≤ a ≤ m), which was originally shown by the indicator. The third line contains an integer b (1 ≤ b ≤ m) - Sovunya's favorite number.
Output
Print a single integer - the minimum number of button presses that Losyash needs to make in order to display b on the indicator.