iitk2p06_21575
You are given e even and o odd numbers. In a single operation, you change an even to odd number or vice versa. Find out min number of operations needed to
do such that ratio of even to odd numbers becomes 2 : 3. If it is impossible to do so, output -1.


Input

The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
For each test case, there will be a single line of input containing two space separated integers e and o.


Output

For each test case, output a single line containing a single integer corresponding to the answer of the problem.


Constraints

1 ≤ T ≤ 10^5
1 ≤ e, o ≤ 10^9


Example
Input:
3
2 3
3 2
3 3
Output:
0
1
-1

Explanation
Example case 1. Ratio of even : odd numbers are already 2 : 3. So no need of any operation.
Example case 2. Change one even to odd, you will have 2 even and 3 odd satisfying the ratio. So only 1 operation is needed.
Example case 3. There is no way of doing operations which could make desired ratio.
#Anwesh Mohanty
t=input()
while t>0:
	a,b=map(int,raw_input().split())
	if((a+b)%5==0):
		r=int(2*(a+b)/5)
		print abs(r-a)
	else:
		print -1
	t-=1