#nt502. 组合数取模1

组合数取模1

Binomial Coefficient Modulo (1)

Problem Description

Answer TT test cases. For each case, output the value of (nm) mod 109+7{n \choose m} \bmod {10^9+7}.

Input Format

The first line contains an integer TT, the number of test cases.

For each test case, a line contains two integers n,mn, m.

Output Format

For each test case, output one line containing the answer.

Sample Input

3
5 2
50 20
500 200

Sample Output

10
211914057
395607423

Constraints

For all data, 1≤T≤1051\leq T\leq 10^5 and 1≤m≤n≤1071\leq m\leq n\leq 10^7 are guaranteed.