Tim likes Math. He likes it so much that he always brings his tablets with him and reads math e-books everywhere, even during parties.
Tim found an interesting exercise in one of the e-books he is reading. But you want him to join the party, so you decide to answer the question for him.
The problem is: Given and , how many ordered pairs of integers are there whose absolute difference is and whose product is ? In other words, how many pairs of integers are there such that:
Input Format
The first line of input contains , the number of test cases. The next lines describe the test cases.
Each test case consists of a single line containing two integers and separated by a single space.
Output Format
For each test case, output a single line containing a single integer which is the answer for that test case.
Constraints
Sample Input
3
1 2
0 4
-1 1
Sample Output
4
2
0
Explanation
Case 1: There are four pairs of integers with absolute difference and product , namely , , , .
Case 2: There are two pairs of integers with absolute difference and product , namely , .
Case 3: There are no pairs of integers with absolute difference , because the absolute value is never negative.