A Math Problem

아직 제출이 없습니다시간 제한1초메모리 제한256 MB

문제

There are nn fans F_i(i=1,,n)F\_i(i=1,\cdots,n) and mm teams T_j(j=1,,m)T\_j(j=1,\cdots,m).

(i) For any fan F_iF\_i, F_iF\_i is a fan of at least one team but not a fan of all teams.

(ii) For any two teams T_i,T_jT\_{i}, T\_{j}(1i,jm1 \leq i,j \leq m), there exists exactly one team T_kT\_{k}(1km1 \leq k \leq m) exactly having the fans both T_iT\_{i} and T_jT\_{j} have. Note that i,j,ki,j,k can be the same.

(iii) For any two teams T_i,T_jT\_{i}, T\_{j}(1i,jm1 \leq i,j \leq m), there exists exactly one team T_kT\_{k}(1km1 \leq k \leq m) exactly having the fans either T_iT\_{i} or T_jT\_{j} have. Note that i,j,ki,j,k can be the same.

Please calculate that How many kinds of correspondences between the fans and the teams.

입력

There are multiple test cases. The first line of the input contains an integer TT(T100000T \leq 100000), indicating the number of test cases. For each test case:

The first and only line contains two integers n,m(1n1018,2m6)n,m(1\leq n\leq10^{18},2\leq m\leq6).

출력

For each test case, output a integer representing the answer modulo 1000000007(109+7)1000000007(10^9+7) in one line.