To proof himself is no longer a pupil, Hamster is going to solve a math problem from his brother in junior high school.
His brother is learning the quadradic equation recently, and his teacher give him a problem like this:
Find all the solution of the following equation:
where are all integers in range
and
is a given consistant.
Hamster doesn't know how to solve this equation due to his poor math skills, so now he turns to your help.
Can you tell him the number of valid solutions for this equation?
Note: Two Solutions are considered different if there exists an integer such that
is different for two solutions.
The test files contain one or more test cases, the first line contains a integer
, representing the number of test cases in this file.
For the following
lines, each line contains two integers
, the constant of this equations. Here
.
It is guaranteed that
for all the test cases.
For each test case, output one integerin a single line, representing the number of solutions for each given
.