#include #include #include #include #include #include using namespace std; using ll=long long; #include using mint=atcoder::modint998244353; #include struct FPS{ vector f; FPS(){} FPS(int n){f.resize(n);} FPS(const vector& v):f(v){} template FPS(int n,T val){f.resize(n,val);} int size() const{ return (int)f.size();} mint& operator[](int i){return f[i];} const mint& operator[](int i) const{return f[i];} void resize(int n) {f.resize(n);} void pop_back() {f.pop_back();} template FPS(const vector& v){ f.resize(v.size()); for(int i=0;if,other.f)); } template FPS operator*(const T& c) const{ FPS res(*this); for(auto& x:res.f)x*=c; return res; } template FPS operator/(const T& c) const{ assert(c!=0); FPS res(*this); for(auto& x:res.f)x/=c; return res; } FPS& operator+=(const FPS& other) {return *this = *this + other;} FPS& operator-=(const FPS& other) {return *this = *this - other;} template FPS& operator*=(const T& c){return *this = *this * c;} template FPS& operator/=(const T& c){return *this = *this / c;} //もろもろ FPS diff(int sz=-1) const{ if(size()==0)return (*this); if(sz==-1)sz=size(); FPS res(sz-1); for(int i=1;i FPS operator*(const T& c,const FPS& f){ return f*c; } // f=g*q+rなる(q,r) pair div_mod(FPS f,FPS g){ while(f.size()>0&&f[f.size()-1]==0)f.pop_back(); while(g.size()>0&&g[g.size()-1]==0)g.pop_back(); int n=f.size(),m=g.size(); assert(m>0); if(n vector multipoint_evaluation(FPS f,vector x){ int n=f.size(),m=x.size(); int sz=1; while(sz prods(sz*2); for(int i=0;i0;i--){ prods[i]=prods[i*2]*prods[i*2+1]; } vector rems(sz*2); rems[1]=div_mod(f,prods[1]).second; for(int i=2;i<2*sz;i++){ rems[i]=div_mod(rems[i/2],prods[i]).second; } vector res(m); for(int i=0;i0){ FPS gn=g; for(int i=1;i fv,gv; for(int i=0;i>=1; f=FPS(fv); g=FPS(gv); } return f[0]/g[0]; } // memo // P/QのPを復元したいなら // P=QS mod x^lでok FPS berlekamp_massey(vector s){ FPS C(1,1); FPS B(1,1); int m=1,l=0; mint b=1; int n=s.size(); for(int i=0;i power_projection(FPS f,FPS g,int m,int k){ int szx=1,szy=2; while(szx0){ FPS h=f; for(int i=0;i fact(m+1,1),factinv(m+1,1); for(int i=0;i res(m+1); for(int i=0;i<=m;i++)res[i]=res0[i]*fact[i]; return res; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n,m; cin>>n>>m; FPS a(n),b(n),c(n); for(int i=0;i>t; a[i]=t; } for(int i=0;i>t; b[i]=t; } for(int i=0;i>t; c[i]=t; } auto v=power_projection(b,FPS(1,1),n-1,n-1); FPS r(n); for(int i=0;i x(m); for(int i=0;i