Elsa and Anna are having a competition to see who can unwrap the most presents! Elsa is able to unwrap presents every minute, and Anna is able to unwrap presents every minute. However, Anna starts minutes late because they were too busy practicing for the competition! Since Anna really wants to win this competition, she asks you to find the minimum number of minutes this competition has to last for her to win (unwrap more presents than the other person), or output if it is impossible.
Input Specification
There is one line of input, with space-separated integers , , and .
For all cases, , , .
Note that the answer may not necessarily be able to be stored in a -bit integer. You are recommended to use long long
in C++ and long
in Java.
Output Specification
Output one integer, the minimum number of minutes needed for the competition so that Anna wins this competition, or if it is impossible.
Sample Input 1
2 3 5
Sample Output 1
16
Sample Explanation 1
For the minutes that Anna is missing, Elsa has already unwrapped presents, which means that Anna must unwrap more presents to beat Elsa. Once Anna arrives, for every minute, she will be unwrapping one more present than Elsa, so it takes more minutes to unwrap more presents than Elsa. We see that minutes.
Sample Input 2
10 10 1
Sample Output 2
-1
Sample Explanation 2
Anna will never be able to unwrap more presents that Elsa since they unwrap at the same speed and Anna starts late.
Sample Input 3
1 100 99
Sample Output 3
101
Comments