#include #include #define eb emplace_back #define all(a) (a).begin(),(a).end() #define RD(T,...) T __VA_ARGS__;li(__VA_ARGS__) #define LL(...) RD(ll,__VA_ARGS__) #define VL(n,...) vl __VA_ARGS__;setsize({n},__VA_ARGS__);li(__VA_ARGS__) #define JO(a,b) a##b #define jo(a,b) JO(a,b) #define uq_symbol(a) jo(a,__LINE__) #define FE(v,e,...) for(au&&__VA_OPT__([)e __VA_OPT__(,__VA_ARGS__]):v) #define FO(n) for(ll uq_symbol(i)=n;uq_symbol(i)-->0;) #define FOR(i,...) for(au[i,i##O,i##E]=rng(0,__VA_ARGS__);i=i##O;i-=i##E) #define I template #define J class #define au auto #define rr return using std::cin,std::cout,std::begin,std::end,std::rbegin; using std::swap,std::move,std::abs,std::prev,std::next; using std::tuple,std::array,std::bitset,std::minmax,std::get; using vo=void;using bo=bool; vo solve(); using is=std::istream;using os=std::ostream; using dd=long double;using ll=long long;using ull=unsigned long long; using lll=__int128_t;using ulll=__uint128_t;using str=std::string; using namespace atcoder;using ml=modint;au&operator<<(os&o,const ml&x){rr o<0?x:-x);} constexpr ll oo=3e18; constexpr ll dx[]{-1,0,1,0,-1,1,1,-1},dy[]{0,-1,0,1,-1,-1,1,1}; constexpr char sp=32; constexpr char nl=10; au rng(bo s,ll a,ll b=oo,ll c=1){if(b==oo)b=a,(s?b:a)=0;rr tuple{a-s,b,c};} ll pwm1(ll x){rr 1-2*(x&1);} IT sq(T a){rr a*a;} Ill len(const T&a){rr a.size();} Iau max(const A&...a){rr max(std::initializer_list>{a...});} Iau min(const A&...a){rr min(std::initializer_list>{a...});} struct edg{ ll t,w; edg(){} edg(ll t,ll w=1):t(t),w(w){} friend os&operator<<(os&o,const edg&e){rr o<struct cp{ A a={};B b={}; cp(){} cp(A a,B b):a(a),b(b){} cp(std::pairp):a(p.first),b(p.second){} bo operator==(const cp&c)const{rr a==c.a&&b==c.b;} bo operator<(const cp&c)const{rr a!=c.a?a(const cp&c)const{rr a!=c.a?a>c.a:b>c.b;} friend is&operator>>(is&i,cp&c){rr i>>c.a>>c.b;} friend os&operator<<(os&o,const cp&c){rr o<; Istruct tr{ A a={};B b={};C c={}; tr(){} tr(A a,B b,C c):a(a),b(b),c(c){} bo operator==(const tr&t)const{rr a==t.a&&b==t.b&&c==t.c;} au operator<(const tr&t)const{rr a!=t.a?a>(is&i,tr&t){rr i>>t.a>>t.b>>t.c;} friend os&operator<<(os&o,const tr&t){rr o<; IT&rv(T&a){reverse(all(a));rr a;} Iau pot(T&a){au r=a.top();a.pop();rr r;} Istruct qmin:std::priority_queue,std::greater<>>{ qmin(const std::vector&a={}){fe(a,e)this->emplace(e);} qmin(const std::initializer_list&a){fe(a,e)this->emplace(e);} friend os&operator<<(os&o,qmin q){while(len(q))o<0,sp);rr o;} }; Istruct ve; Iconstexpr bo isv=0; Iconstexpr bo isv> =1; Iconstexpr bo isv> =1; Iau rawv(V){if constexpr(isv)rr rawv(V(1)[0]);else rr V();} Istruct ve:std::vector{ using std::vector::vector; using T=decltype(rawv(V())); Ive(const std::vector&v={}){fe(v,e)this->eb(e);} ve&operator+=(const ve&u){au&v=*this;fo(i,len(v))v[i]+=u[i];rr v;} ve&operator-=(const ve&u){au&v=*this;fo(i,len(v))v[i]-=u[i];rr v;} ve&operator^=(const ve&u){fe(u,e)this->eb(e);rr*this;} ve&operator+=(const T&x){au&v=*this;fe(v,e)e+=x;rr v;} ve&operator-=(const T&x){au&v=*this;fe(v,e)e-=x;rr v;} ve&operator*=(const T&x){au&v=*this;fe(v,e)e*=x;rr v;} Iau&operator+=(const bitset&a){fo(i,n)(*this)[i]+=a[i];rr*this;} Iau&operator-=(const bitset&a){fo(i,n)(*this)[i]-=a[i];rr*this;} ve operator+(const ve&u)const{rr ve(*this)+=u;} ve operator-(const ve&u)const{rr ve(*this)-=u;} ve operator^(const ve&u)const{rr ve(*this)^=u;} ve operator+(const T&x)const{rr ve(*this)+=x;} ve operator-(const T&x)const{rr ve(*this)-=x;} ve operator*(const T&x)const{rr ve(*this)*=x;} ve&operator++(){rr*this+=1;} ve&operator--(){rr*this-=1;} ve operator-()const{rr ve(*this)*=-1;} au lower_bound(const V&x)const{rr std::lower_bound(all(*this),x);} au upper_bound(const V&x)const{rr std::upper_bound(all(*this),x);} Iau scan(F f)const{cpr;fe(*this,e)if constexpr(!isv)r.b?f(r.a,e),r:r={e,1};else if(au s=e.scan(f);s.b)r.b?f(r.a,s.a),r:r=s;rr r;} T max()const{rr scan([](T&a,const T&b){ab?a=b:0;;}).a;} vo df(){this->erase(this->begin());} }; Iau vec(const ll(&s)[n],T x={}){ if constexpr(n==i+1)rr ve(s[i],x); else{au X=vec(s,x);rr ve(s[i],X);} } Ivo setsize(const ll(&l)[n],A&...a){((a=vec(l,rawv(a))),...);} Iusing vve=ve>;using vl=ve;using vvl=vve; using gl=ve>;using ge=ve>; struct io{io(){cin.tie(0)->sync_with_stdio(0); cout<os&operator<<(os&o,const bitset&b){fo(i,n)o<os&operator<<(os&o,const tuple&t){ apply([&](const au&...a){ll i=0;(((o<os&operator<<(os&o,const std::vector&v){fe(v,e)o<?nl:sp);rr o;} Ivo pp(const A&...a){ll i=0;((cout<is&operator>>(is&i,std::vector&v){fe(v,e)i>>e;rr i;} Ivo li(A&...a){(cin>>...>>a);} ll inv(ll x,ll m){ll a=(x%m+m)%m,b=m,u=1,v=0;while(b)u-=a/b*v,swap(u,v),a-=a/b*b,swap(a,b);rr(u%m+m)%m;} Istruct rec:F{rec(F&&f):F(std::forward(f)){}Idecltype(au)operator()(A&&...a)const{rr F::operator()(*this,std::forward(a)...);}}; //https://ei1333.github.io/luzhiled/snippets/math/fast-fourier-transform.html namespace fft{ using real=double; struct C{ real x,y; C():x(0),y(0){} C(real x,real y):x(x),y(y){} inline C operator+(const C &c)const{return C(x+c.x,y+c.y);} inline C operator-(const C &c)const{return C(x-c.x,y-c.y);} inline C operator*(const C &c)const{return C(x*c.x-y*c.y,x*c.y+y*c.x);} inline C conj()const{return C(x,-y);} }; const real PI=acosl(-1); ll base=1; std::vectorrts={{0,0},{1,0}}; std::vectorrev={0,1}; vo ensure_base(int nbase){ if(nbase<=base)return; rev.resize(1<>1]>>1)+((i&1)<<(nbase-1)); while(base&a,int n){ assert((n&(n-1))==0); int zeros=__builtin_ctz(n); ensure_base(zeros); int shift=base-zeros; fo(i,n)if(i<(rev[i]>>shift))swap(a[i],a[rev[i]>>shift]); for(int k=1;kstruct arbitrary_mod_convolution{ using real=fft::real; using C=fft::C; arbitrary_mod_convolution()=default; std::vectormultiply(const std::vector&a,const std::vector&b,int need=-1){ if(need==-1)need=len(a)+len(b)-1; int nbase=0; while((1<fa(sz); fo(i,len(a))fa[i]=C(a[i].val()&((1<<15)-1),a[i].val()>>15); fft::fft(fa,sz); std::vectorfb(sz); if(a==b){ fb=fa; }else{ fo(i,len(b))fb[i]=C(b[i].val()&((1<<15)-1),b[i].val()>>15); fft::fft(fb,sz); } real ratio=0.25/sz; C r2(0,-1),r3(ratio,0),r4(0,-ratio),r5(0,1); for(int i=0;i<=(sz>>1);i++){ int j=(sz-i)&(sz-1); C a1=(fa[i]+fa[j].conj()); C a2=(fa[i]-fa[j].conj())*r2; C b1=(fb[i]+fb[j].conj())*r3; C b2=(fb[i]-fb[j].conj())*r4; if(i!=j){ C c1=(fa[j]+fa[i].conj()); C c2=(fa[j]-fa[i].conj())*r2; C d1=(fb[j]+fb[i].conj())*r3; C d2=(fb[j]-fb[i].conj())*r4; fa[i]=c1*d1+c2*d2*r5; fb[i]=c1*d2+c2*d1; } fa[j]=a1*b1+a2*b2*r5; fb[j]=a1*b2+a2*b1; } fft::fft(fa,sz); fft::fft(fb,sz); std::vectorret(need); fo(i,need){ int64_t aa=llround(fa[i].x); int64_t bb=llround(fb[i].x); int64_t cc=llround(fa[i].y); aa=T(aa).val(),bb=T(bb).val(),cc=T(cc).val(); ret[i]=aa+(bb<<15)+(cc<<30); } return ret; } }; using amc=arbitrary_mod_convolution; //https://ei1333.github.io/luzhiled/snippets/math/formal-power-series.html templatestruct formal_power_series:ve{ using ve::ve; using P=formal_power_series; using MULT=std::function; static MULT&get_mult(){static MULT mult=nullptr;return mult;} static vo set_fft(MULT f){get_mult()=f;} templateformal_power_series(const ve&a){ ll n=len(a); this->resize(n); fo(i,n)(*this)[i]=a[i]; } bo operator<(const P&f)const{return len(*this)(const P&f)const{return len(*this)>len(f);} P&operator+=(const P&f){ if(len(f)>len(*this))this->resize(len(f)); fo(i,len(f))(*this)[i]+=f[i]; return*this; } P&operator-=(const P&f){ if(len(f)>len(*this))this->resize(len(f)); fo(i,len(f))(*this)[i]-=f[i]; return*this; } P&operator+=(const T&t){if(!len(*this))this->resize(1);(*this)[0]+=t;return*this;} P&operator-=(const T&t){if(!len(*this))this->resize(1);(*this)[0]-=t;return*this;} P&operator*=(const T&t){fo(i,len(*this))(*this)[i]*=t;return*this;} P&operator*=(const P&f){ if(!len(*this)||!len(f))return*this=P(); assert(get_mult()); return*this=get_mult()(*this,f); } P&operator%=(const P&f){*this-=*this/f*f;shrink();return*this;} P&operator/=(const P&f){ if(len(*this)P operator+(const U&t)const{return P(*this)+=t;} templateP operator-(const U&t)const{return P(*this)-=t;} templateP operator*(const U&t)const{return P(*this)*=t;} P operator-()const{P r=*this;fe(r,x)x=-x;return r;} P operator>>(ll sz)const{if(len(*this)<=sz)return P();P r(*this);r.erase(begin(r),begin(r)+sz);return r;} P operator<<(ll sz)const{P r(*this);r.insert(begin(r),sz,T{});return r;} vo shrink(){while(len(*this)&&this->back()==T{})this->pop_back();} P pre(ll deg)const{return P(this->begin(),this->begin()+min(len(*this),deg));} P rev(ll deg=-1)const{P r(*this);if(deg!=-1)r.resize(deg,T{});rv(r);return r;} T operator()(T x)const{T r=0,w=1;fe(*this,v)r+=w*v,w*=x;return r;} P diff()const{ ll n=len(*this); P r(max(n-1,0)); fo(i,1,n)r[i-1]=(*this)[i]*T{i}; return r; } P integral()const{ ll n=len(*this); P r(n+1); r[0]=T{}; fo(i,n)r[i+1]=(*this)[i]/T{i+1}; return r; } P inv(ll deg=-1)const{ assert((*this)[0]!=T{}); ll n=len(*this); if(deg==-1)deg=n; P r{T{1}/(*this)[0]}; for(ll i=1;idiff()*this->inv(deg)).pre(deg-1).integral(); } P exp(ll deg=-1)const{ assert((*this)[0]==T{}); ll n=len(*this); if(deg==-1)deg=n; P r{1}; for(ll i=1;i>i).sqr(deg-i/2); if(mu(r))return{}; r=r<<(i/2); if(len(r)>i).log(deg)*k).exp(deg)*((*this)[i].pow(k)); if(i*k>deg)return P(deg,T{}); r=(r<<(i*k)).pre(deg); if(len(r)constexpr bo isv> =1; //https://nyaannyaan.github.io/library/fps/kitamasa.hpp.html templateT kitamasa(ll n,formal_power_seriesp,formal_power_seriesq){ q.shrink(); T ret=0; if(len(p)>=len(q)){ formal_power_seriesr=p/q; p-=r*q; p.shrink(); if(nq2=q; fo(i,1,len(q2),2)q2[i]=-q2[i]; formal_power_seriess=p*q2; formal_power_seriest=q*q2; if(n&1){ fo(i,1,len(s),2)p[i>>1]=s[i]; fo(i,0,len(t),2)q[i>>1]=t[i]; }else{ fo(i,0,len(s),2)p[i>>1]=s[i]; fo(i,0,len(t),2)q[i>>1]=t[i]; } n>>=1; } return ret+p[0]; } templateT kitamasa(ll n,const ve&a,const ve&c){ assert(len(c)==len(a)); ll k=len(c); formal_power_seriesq=formal_power_series{1}^-fps(c); formal_power_seriesp=(q*fps(a)).pre(k); return kitamasa(n,p,q); } templateformal_power_seriesprod(const ve>&fs){ qmin>q; fe(fs,f)q.emplace(f); while(len(q)>1){ formal_power_seriesf=q.top();q.pop(); formal_power_seriesg=q.top();q.pop(); q.emplace(f*g); } return q.top(); } templatestruct twelvefold{ vefa,rfa,bs; vvem;vveu; twelvefold(ll n):fa(n+1,1),rfa(n+1,1),bs(n+1,1){ fo(i,1,n+1)fa[i]=fa[i-1]*i; rfa[n]=fa[n].inv(); of(i,n)rfa[i]=rfa[i+1]*(i+1); fo(i,1,n+1)bs[i]=bs[i-1]+pwm1(i)*rfa[i]; if(n<=5000)m.resize(n+1,ve(n+1)),u.resize(n+1,ve(n+1)); } T operator()(ll n,ll k){return c(n,k);} T c(ll n,ll k){return n<0?pwm1(k)*c(-n+k-1,k):k<0||n=0)return u[n][k]=1,m[n][k]=par(n,k-1)+par(n-k,k); return u[n][k]=1,m[n][k]=par(n,k-1); } };using twf=twelvefold; int main(){ll T=1;fo(T)solve();} vo solve(){ using ml=modint998244353; using fps=formal_power_series; amc fft; auto mul=[&](const fps&a,const fps&b){ //auto r=fft.multiply(a,b); auto r=convolution(a,b); return fps(r); }; fps::set_fft(mul); LL(N,M); VL(N,a); vefs(N); fo(i,N)fs[i]=fps{1,-a[i]}; fps f=prod(fs); f=-f.log(M+1); vl res(M+1); fo(i,1,M+1)res[i]=(f[i]*i).val(); res.df(); pp(res); }