Andu made a terrible mistake! Just like the time he headed to Neamț and ended up in Târgu Neamț instead of Piatra Neamț, he made a similar mistake at school. He thought that .
Task
Still curious, he asked himself: given two integers and , how many pairs with exist such that ?
Input data
Each test contains multiple test cases. The first line of input contains a single integer , representing the number of test cases.
Each test case consists of one line, containing two space-separated integers and .
Output data
For each test case, print the number of pairs that satisfy the conditions from the statement.
Constraints and clarifications
| # | Score | Constraints |
|---|---|---|
| 0 | 0 | Example |
| 1 | 10 | |
| 2 | 25 | |
| 3 | 10 | |
| 4 | 40 | |
| 5 | 15 | No further restrictions. |
Example
stdin
6
4 2
13 1
7 6
9 8
1 1000
1000000000 30030
stdout
8
169
16
23
1
20877697634
Explanation
In the first test case, the pairs that satisfy the conditions from the statement are: , , , , , , and .
In the second test case, all pairs satisfy the conditions from the statement.