#nt503. 组合数取模2

组合数取模2

Binomial Coefficient Modulo 2

Problem Description

Answer TT queries; for each query 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 queries.

For each query, one line contains two integers n,mn, m.

Output Format

For each query, output one line: the answer.

Sample Input

3
5 2
50 20
500 200

Sample Output

10
211914057
395607423

Constraints

For all data, 1≤T≤101 \leq T \leq 10, 1≤m≤n≤1091 \leq m \leq n \leq 10^9.