Modular C(n,r)

medium
You have T test cases and for each test case you have been given n and r values and you need to find nCr mod 10^9+7.

Input Format

The first line contains an integer T. Next T lines contain integers n and r.

Output Format

for each query print nCr mod 10^9+7 in a line.

Constraints

1 <= T <= 10^6
1 <= n <= 3000
1 <= r <= n

Example

Input
3
4 3
5 2
10 8
Output
4
10
45

Previous
Modular Fast Exponentiation
Next
No Max No Min

Related Questions