F. Good Evening-Morning
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output

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.

Input

The input consists of a single line containing two integers $$$d$$$ and $$$t_0$$$ ($$$0 \leq d,t_0 \leq 23$$$).

Output

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$$$.

Examples
Input
8 12
Output
0
Input
0 16
Output
-1
Input
16 20
Output
10
Note
  • In the first test case, Little A is initially at moment $$$12$$$, and Little E is initially at moment $$$20$$$. At this moment, Little A is in daytime and Little E is in nighttime, so she can send the "good evening-morning" immediately.
  • In the third test case, Little A is initially at moment $$$20$$$, and Little E is initially at moment $$$12$$$. After waiting $$$10$$$ moments, Little A is at moment $$$6$$$ and Little E is at moment $$$22$$$. At this moment, she can send the "good evening-morning".