#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace std::chrono; typedef long long int llint; typedef double lldo; #define mp make_pair #define mt make_tuple #define pub push_back #define puf push_front #define pob pop_back #define pof pop_front #define fir first #define sec second #define res resize #define ins insert #define era erase /*cout<bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;} template bool maxeq(T& a,U b){if(a void SO(T& ve){sort(ve.begin(),ve.end());} template void REV(T& ve){reverse(ve.begin(),ve.end());} templatellint LBI(vector&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();} templatellint UBI(vector&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();} //行列 h,m,r,hm,mr,hmr 3125^2*log using hom=array; int K; hom rui(hom A,hom B){ int i,j,x; int AL=A[3125]; int BL=B[3125]; hom ans={}; for(i=0;i>n>>K; hom bgen={},ans={}; bgen[1]=1; bgen[K]=1; bgen[0]=1; bgen[3125]=1; ans[0]=1; while(n>0){ if(n%2){ans=rui(ans,bgen);} bgen=rui(bgen,bgen); //for(int i=0;i