#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a struct NTT{ static constexpr int md = bmds(X); static constexpr int rt = brts(X); inline int add(int a,int b){ a+=b; if(a>=md) a-=md; return a; } inline int mul(int a,int b){ return 1LL*a*b%md; } inline int pow(int a,int b){ int res=1; while(b){ if(b&1) res=mul(res,a); a=mul(a,a); b>>=1; } return res; } inline int inv(int x){ return pow(x,md-2); } vector > rts,rrts; void ensure_base(int n){ if((int)rts.size()>=n) return; rts.resize(n);rrts.resize(n); for(int i=1;i &a,bool f,int n=-1){ if(n==-1) n=a.size(); assert((n&(n-1))==0); for(int i=0,j=1;j+1>1;k>(i^=k);k>>=1); if(i>j) swap(a[i],a[j]); } for(int i=1;i multiply(const vector &a,const vector &b){ int need=a.size()+b.size()-1; int sz=1; while(sz f(sz),g(sz); for(int i=0;i<(int)a.size();i++) f[i]=a[i]; for(int i=0;i<(int)b.size();i++) g[i]=b[i]; ntt(f,0);ntt(g,0); for(int i=0;i struct ArbitraryModConvolution{ using ll = long long; static NTT<0> ntt0; static NTT<1> ntt1; static NTT<2> ntt2; static constexpr int pow(int a,int b,int md){ int res=1; while(b){ if(b&1) res=(ll)res*a%md; a=(ll)a*a%md; b>>=1; } return res; } static constexpr int inv(int x,int md){ return pow(x,md-2,md); } static constexpr int r01=inv(ntt0.md,ntt1.md); static constexpr int r02=inv(ntt0.md,ntt2.md); static constexpr int r12=inv(ntt1.md,ntt2.md); static constexpr int m01 =(ll)ntt0.md*ntt1.md%MOD; inline void garner(vector< vector > &cs){ size_t sz=cs[0].size(); for(size_t i=0;i=MOD) cs[0][i]-=MOD; cs[0][i]+=(ll)cs[2][i]*m01%MOD; if(cs[0][i]>=MOD) cs[0][i]-=MOD; } } vector multiply(vector a,vector b){ for(int& x:a) x%=MOD; for(int& x:b) x%=MOD; vector< vector > cs(3); cs[0]=ntt0.multiply(a,b); cs[1]=ntt1.multiply(a,b); cs[2]=ntt2.multiply(a,b); size_t sz=a.size()+b.size()-1; for(auto& v:cs) v.resize(sz); garner(cs); return cs[0]; } }; template NTT<0> ArbitraryModConvolution::ntt0; template NTT<1> ArbitraryModConvolution::ntt1; template NTT<2> ArbitraryModConvolution::ntt2; template struct Mint{ using value_type = T; static constexpr T mod = MOD; T v; Mint():v(0){} Mint(signed v):v(v){} Mint(long long t){v=t%MOD;if(v<0) v+=MOD;} Mint pow(long long k){ Mint res(1),tmp(v); while(k){ if(k&1) res*=tmp; tmp*=tmp; k>>=1; } return res; } static Mint add_identity(){return Mint(0);} static Mint mul_identity(){return Mint(1);} Mint inv(){return pow(MOD-2);} Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;} Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;} Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;} Mint& operator/=(Mint a){return (*this)*=a.inv();} Mint operator+(Mint a) const{return Mint(v)+=a;}; Mint operator-(Mint a) const{return Mint(v)-=a;}; Mint operator*(Mint a) const{return Mint(v)*=a;}; Mint operator/(Mint a) const{return Mint(v)/=a;}; Mint operator-() const{return v?Mint(MOD-v):Mint(v);} bool operator==(const Mint a)const{return v==a.v;} bool operator!=(const Mint a)const{return v!=a.v;} bool operator <(const Mint a)const{return v constexpr T Mint::mod; template ostream& operator<<(ostream &os,Mint m){os< M factorial(int n){ if(n>=M::mod) return M(0); int d=1<<14; vector fact(d*2+1,1),finv(d*2+1,1); for(int i=1;i<=d*2;i++) fact[i]=fact[i-1]*M(i); finv[d*2]=fact[d*2].inv(); for(int i=d*2-1;i>=0;i--) finv[i]=finv[i+1]*M(i+1); ArbitraryModConvolution arb; int sz=1; vector seq({1,d+1}); seq.reserve(d+1); while(sz aux(sz,1); vector f(sz*4,0),g(sz*4,0); for(int i=0;i<=sz;i++){ f[i]=(finv[i]*finv[sz-i]*seq[i]).v; if(((sz+i)&1)&&(f[i]!=0)) f[i]=M::mod-f[i]; } vector pf(f); vector as; as.emplace_back(sz+1); as.emplace_back(M(sz)/M(d)); as.emplace_back(M(sz)/M(d)+M(sz+1)); for(int idx=0;idx<3;idx++){ for(int i=0;i; int n; cin>>n; cout<(n)<