#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define popcount __builtin_popcount using namespace std; using namespace atcoder; typedef long long ll; typedef pair P; using mint=modint998244353; mint f[2000010], invf[2000010]; void fac(int n){ f[0]=1; for(ll i=1; i<=n; i++) f[i]=f[i-1]*i; invf[n]=f[n].inv(); for(ll i=n-1; i>=0; i--) invf[i]=invf[i+1]*(i+1); } mint comb(int x, int y){ if(!(0<=y && y<=x)) return 0; return f[x]*invf[y]*invf[x-y]; } template struct LazySegmentTree{ using F=function; using G=function; using H=function; int sz; vector data; vector lazy; F f; G g; H h; Monoid e1; OperatorMonoid e0; LazySegmentTree(){} LazySegmentTree(int n, const F f, const G g, const H h, const Monoid &e1, const OperatorMonoid &e0): f(f), g(g), h(h), e1(e1), e0(e0){ sz=1; while(sz v){ for(int i=0; i=0; i--) data[i]=f(data[2*i+1], data[2*i+2]); } void eval(int k, int l, int r){ if(lazy[k]!=e0){ data[k]=g(data[k], lazy[k], r-l); if(k>n>>k>>m; for(int i=0; i>l>>r; lmx[r]=max(lmx[r], l); } using mb=pair; auto f=[&](mint a, mint b){ return a+b; }; auto g=[&](mint a, mb x, int len){ if(x.second) return x.first*len; return a; }; auto h=[&](mb x, mb y){ if(y.second) return y; return x; }; vector> seg(k+1); for(int i=0; i<=k; i++) seg[i].init(k+1, f, g, h, 0, make_pair(0, 0)); seg[0].update(0, 1, make_pair(1, 1)); for(int i=1; i<=k; i++){ for(int j=i-1; j>=0; j--){ mint v=seg[j].data[0]; seg[j+1].update(i, i+1, make_pair(v, 1)); seg[j].update(0, lmx[i], make_pair(0, 1)); } } mint x[1515]; fac(k+1); for(int i=1; i<=k; i++){ x[i]=mint(i).pow(n); for(int j=1; j