#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define popcount __builtin_popcount //#define double long double using namespace std; typedef long long int ll; typedef pair P; const int MOD=1e9+7; typedef complex Cd; const double PI=acos(-1.0); vector tmp; size_t sz; vector rots; const int N=1<<18; void init(){ rots.resize(N+1); for(int j=0; j<=N; j++){ rots[j].real(cos(2*PI*j/N)); rots[j].imag(sin(2*PI*j/N)); } } vector fft(vector a, bool inv=false){ size_t mask=sz-1; size_t p=0; for(size_t i=sz>>1; i>0; i>>=1){ auto& cur=((p&1) ? tmp : a); auto& nex=((p&1) ? a : tmp); //Cd e=polar((double)1.0, 2*PI*i*(inv ? -1.0 : 1.0)/sz); Cd w; size_t d=i*(N/sz), t=(inv ? N : 0); for(size_t j=0; j convolution(vector a, vector b){ size_t m=a.size()+b.size()-1; sz=1; while(sz A(sz), B(sz); for(size_t i=0; i ans(m); for(size_t i=0; i convolution(vector a, vector b){ size_t m=a.size()+b.size()-1; sz=1; while(sz A(sz), B(sz), C(sz), D(sz); for(size_t i=0; i>15); for(size_t i=0; i>15); A=fft(A); B=fft(B); for(size_t i=0; i ans(sz); for(size_t i=0; i p, int k){ vector p0; p0.push_back(p[0]); vector ret(1, 1); int i=0; while((1< p1=convolution(ret, p0); p1.resize(1<>k>>n; vector p(100001, 0); p[0]=1; for(int i=0; i>x; p[x]=MOD-1; } init(); cout<