On an unknown planet deep in the universe, a day consists of $$$24$$$ moments, numbered from $$$0$$$ to $$$23$$$ (only integer moments are considered in this problem). Moments $$$6$$$ to $$$17$$$ of a day are daytime, while moments $$$0$$$ to $$$5$$$ and $$$18$$$ to $$$23$$$ are nighttime. The moment after $$$23$$$ is moment $$$0$$$ of the next day.
Little A and Little E live in different cities. There may be a time difference between the two cities. Little E's time zone is $$$d$$$ moments later than Little A's time zone. That is, if Little A's time zone is at moment $$$t$$$, then Little E's time zone is at moment $$$(t + d) \bmod 24$$$.
Now, Little A is currently at moment $$$t_0$$$. Little A wants to send a "good evening-morning" greeting to Little E, but when she sends the message, Little A must be in daytime and Little E must be in nighttime. What is the minimum number of moments she must wait to send this greeting? Note that there may be cases where she can never send the message.
The input consists of a single line containing two integers $$$d$$$ and $$$t_0$$$ ($$$0 \leq d,t_0 \leq 23$$$).
Output an integer representing the minimum number of moments Little A must wait. If she needs no waiting, output $$$0$$$. If she can never send the message, output $$$-1$$$.
8 12
0
0 16
-1
16 20
10
| Name |
|---|


