You are given two integers n and m. Among the integer pairs (a,b) with 0<a<b<n, count the pairs for which aba2+b2+m is an integer.
The first line holds the number of test cases T. Each of the next T lines holds one test case, with n and m separated by a space. Both numbers are greater than 0 and at most 100.
For each test case, print the number of pairs (a,b) that satisfy the condition, one per line.