//http://acm.hdu.edu.cn/showproblem.php?pid=5015 #include #include #include using namespace std; typedef long long LL; const int P=10000007; const int SIZE=1152; int n,m; LL v[12],a[12][12],b[12][12]; inline void mul(LL a[12][12],LL b[12][12],LL c[12][12]) { memset(c,0,SIZE); for(int i=0;i>=1) { if(b&1) { mul(c,a,t); memcpy(c,t,SIZE); } mul(a,a,t); memcpy(a,t,SIZE); } } int main() { #ifdef local freopen("pro.in","r",stdin); #endif while(scanf("%d%d",&n,&m)==2) { n+=2; for(int i=2;i