A. Perfect Sandwiches
time limit per test
1 second
memory limit per test
512 megabytes
input
standard input
output
standard output

Monocarp has $$$a$$$ slices of cheese and $$$b$$$ slices of sausage. He wants to make the maximum possible number of sandwiches for his friends from them.

Monocarp is very thrifty, so he must use all $$$a$$$ slices of cheese and all $$$b$$$ slices of sausage without any leftovers to make the sandwiches. In addition, he has the following rules for making sandwiches:

  • each sandwich must contain at least one slice of cheese and at least one slice of sausage;
  • each of the $$$a$$$ slices of cheese and each of the $$$b$$$ slices of sausage must be placed on exactly one sandwich;
  • for each sandwich, the number of slices of cheese must be strictly greater than the number of slices of sausage.

Help Monocarp determine the maximum number of sandwiches he can make, or determine that it is impossible to distribute all slices according to these rules.

Input

The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.

The only line of each test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 100$$$) — the number of slices of cheese and sausage, respectively.

Output

For each test case, print one integer — the maximum number of sandwiches that can be made. If it is impossible to distribute all pieces according to the described rules, print $$$-1$$$ instead.

Example
Input
3
6 4
5 1
4 5
Output
2
1
-1
Note

In the first test case, it is possible to make $$$2$$$ sandwiches. For example, each of the two sandwiches can be made from three slices of cheese and two pieces of sausage.

In the second test case, it is possible to make $$$1$$$ sandwich from five slices of cheese and one slice of sausage.

In the third test case, it is impossible to make sandwiches while using all slices of cheese and sausage, so you have to print $$$-1$$$.