题目描述
Murgi is very generous. Today she is very happy as she got placed in her dream company. To celebrate this moment, she decided to distribute some Candies among
beggars. She wants to distribute these Candies equally, among all the beggars.
Initially, she had X Candies with her and after distributing them, equally among beggars, she is still left with Y Candies. Unfortunately, she forgot to count the number of beggars. Now she wonders how many beggars were there.
So, she goes to Mr. Prashasi for the solution of her problem. Now Mr. Prashasi gave her a list of possible number of beggars to her.
On Behalf of Mr. Prashasi write a program to solve Murgi's problem.
Input:
First line will contain an integer T, the no. of test cases.
Next T lines will have 2 integers X and Y.
Output:
You have to output the count of possible number of beggars.
If there are infinite possibilities output -1.
Constraints:
1 ≤ T ≤ 50
0 ≤ X ≤ 1000000000
0 ≤ Y ≤ 1000000000
SAMPLE INPUT
1
14 2
SAMPLE OUTPUT
4
Explanation
If X=14 and Y=2 then the possible number of beggars are 3, 4, 6 and 12.
输入格式
见题面
输出格式
见题面