Problem F. Funny Function

时间限制 1000 ms   内存限制 32 MB

Function $F_{x,y}$satisfies:

For given integers N and M,calculate $F_{m,1}$ modulo 1e9+7.
 

输入数据

There is one integer T in the first line.
The next T lines,each line includes two integers N and M .
1<=T<=10000,1<=N,M<2^63.
 

输出数据

For each given N and M,print the answer in a single line.
 

样例输入

复制
2
2 2
3 3

样例输出

复制
2
33

提交

请先 登录

© 2025 FAQs Contact About