1661. Funny Function

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

Function $F_{x,y}$satisfies:

20170730153723_22935.jpg

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 \n
 · \n
 · \n

样例输出

复制
2
33 \n
  \n

提交

请先 登录

Source

2017 Multi-University Training Contest - Team 2

© 2024 FAQs Contact About