P20408 [HackerEarth] 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
普及
题目描述

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.

输入格式

见题面

输出格式

见题面

样例输入
38 21 5 9435152 272 10 10 0 1000000000 11 2 1 0 0 0 121 0 772930485 686893955 257424 24 295138437 589952171 223093836 966 233758336 10665466 223092887 17 223094728 1858 223092899 29 997920 0 887043 3 124 24 982901 101 357987 35 954374 1030 49106 46 325508499 119510657 89768760 885778845 944387968 700818251 12 3 1000000000 1 923456789 3 1000000000 6 1000000000 333333300 5 2 1 10 15 3 2 0 77 75 1000000000 1000000000
样例输出
2 282 -1 0 2 1 -1 3 0 127 0 399 13 500 371 495 240 213 3 193 45 32 15 1 0 0 1 19 14 6 2 1 0 3 2 0 -1 -1