SOLVE
LATER
Today Oz has an interesting problem for you. Oz has a set of $$M$$ balls numbered from 0 to $$M$$-1. He has removed $$X$$ balls from the set and calculated the sum of the numbers of removed balls. He has given you a hint that the sum is divisible by $$M$$.
Now your task is to count the number of ways of removing $$X$$ balls. Output the answer modulo 10^{9}+7.
Input:
First line contains one integer $$T$$ - number of test cases.
Each test case contains two space separated integers $$M$$ and $$X$$.
Output:
For each test case output the desired answer modulo 10^{9}+7.
Constraints:
1 ≤ $$T$$ ≤ 10
1 ≤ $$M$$ ≤ 10^{9}
1 ≤ $$X$$ ≤ 10^{5}
$$X$$ ≤ $$M$$
7 balls are numbered from 0 to 6 and 4 of them are removed. Possible removals are {0, 3, 5, 6}, {1, 2, 5, 6}, {2, 3, 4, 5}, {0, 1, 2, 4}, {1, 3, 4, 6}.
Challenge Name
HackerEarth Collegiate Cup - First Elimination
HackerEarth Collegiate Cup - First Elimination