#abc297d. [abc297_d]Count Subtractions
[abc297_d]Count Subtractions
Problem Statement
You are given positive integers and .
You will repeat the following operation until :
- compare and to perform one of the following two:
- if , replace with ;
- if , replace with .
How many times will you repeat it until ? It is guaranteed that a finite repetition makes .
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3 8
Sample Output 1
4
Initially, and . You repeat the operation as follows:
- , so replace with , making and .
- , so replace with , making and .
- , so replace with , making and .
- , so replace with , making and .
Thus, you repeat it four times.
Sample Input 2
1234567890 1234567890
Sample Output 2
0
Note that the input may not fit into a 32-bit integer type.
Sample Input 3
1597 987
Sample Output 3
15