TV
At the moment, Barysh is watching channel 𝑎 on TV but wants to switch to channel because an interesting football match is showing there. The TV remote is broken, only two buttons work. When one of these buttons is pressed, the TV switches to a channel with a number unit higher, and when the other button is pressed, the TV switches to a channel with a number units higher. Barysh wants to quickly switch to channel , pressing the minimum number of buttons, but there's a problem with channels whose numbers are exactly divisible by . When Barysh switches the TV to such a channel, the TV breaks.
What is the minimum number of button presses for Barysh to switch from channel number to channel number ?
Input
The first line contains an integer , the second line contains an integer , and the third line contains an integer . It is guaranteed that and are not divisible by .
Output
Print the minimum number of button presses for Barysh to switch from channel number to channel number .
Examples
In the first example, the transitions can be performed as follows: .
In the second example, the transitions can be performed as follows: .
Scoring
This problem consists of subtasks. Points for a subtask are awarded only if all the tests associated with that subtask are passed successfully.
( points): ;
( points): ;
( points): ;
( points): ;