There are n fans F_i(i=1,⋯,n) and m teams T_j(j=1,⋯,m).
(i) For any fan F_i, F_i is a fan of at least one team but not a fan of all teams.
(ii) For any two teams T_i,T_j(1≤i,j≤m), there exists exactly one team T_k(1≤k≤m) exactly having the fans both T_i and T_j have. Note that i,j,k can be the same.
(iii) For any two teams T_i,T_j(1≤i,j≤m), there exists exactly one team T_k(1≤k≤m) exactly having the fans either T_i or T_j have. Note that i,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 T(T≤100000), indicating the number of test cases. For each test case:
The first and only line contains two integers n,m(1≤n≤1018,2≤m≤6).
For each test case, output a integer representing the answer modulo 1000000007(109+7) in one line.