Jash has a 24-hour magical clock.
-The clock shows hours from 0 to 23.
-Every hour, the clock automatically jumps forward by a number of hours equal to the sum of the digits of the current hour.
For example, if the clock shows 14, the sum of digits is 1 + 4 = 5, so in one hour it jumps to (14 + 5) mod 24 = 19.
Jash wants to know: starting from hour h , how many steps will it take for the clock to reach hour t for the first time?
Constraints
Input Format
A single line containing two integers: h and t — the starting hour and target hour.
Output Format
Print a single integer — the minimum number of steps to reach t from h.
If the clock can never reach t, print -1.
Example 1
Input:
14 19
Output:
1
Explanation:
-
Log In to solve the Question