#include using namespace std; #if __has_include() #include using namespace atcoder; #endif using ll = long long; using ld = long double; using ull = unsigned long long; #define endl "\n" typedef pair Pii; #define REP(i, n) for (int i = 0; i < (n); ++i) #define REP3(i, m, n) for (int i = (m); (i) < int(n); ++ (i)) #define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++) #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define ALL(x) begin(x), end(x) #define PB push_back #define rrep(i,a,b) for(int i=a;i>=b;i--) #define fore(i,a) for(auto &i:a) #define all(s) (s).begin(),(s).end() #define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i) #define drep(i, n) drep2(i, n, 0) #define rever(vec) reverse(vec.begin(), vec.end()) #define sor(vec) sort(vec.begin(), vec.end()) #define fi first #define se second #define pb push_back #define P pair #define PQminll priority_queue, greater> #define PQmaxll priority_queue,less> #define PQminP priority_queue, greater

> #define PQmaxP priority_queue,less

> #define NP next_permutation typedef string::const_iterator State; class ParseError {}; //const ll mod = 1000000009; const ll mod = 998244353; //const ll mod = 1000000007; const ll inf = 4100000000000000000ll; const ld eps = ld(0.00000000000001); //static const long double pi = 3.141592653589793; templatevoid vcin(vector &n){for(int i=0;i>n[i];} templatevoid vcin(vector &n,vector &m){for(int i=0;i>n[i]>>m[i];} templatevoid vcout(vector &n){for(int i=0;ivoid vcin(vector> &n){for(int i=0;i>n[i][j];}}} templatevoid vcout(vector> &n){for(int i=0;ivoid print(T a){cout<auto min(const T& a){ return *min_element(all(a)); } templateauto max(const T& a){ return *max_element(all(a)); } templatevoid print(pair a){cout<bool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b void ifmin(T t,T u){if(t>u){cout<<-1< void ifmax(T t,T u){if(t>u){cout<<-1<>=1;v>>=1;}else if(eu&&!ev){u>>=1;}else if(!eu&&ev){v>>=1;}else if(u>=v){u=(u-v)>>1;}else{ll tmp=u;u=(v-u)>>1;v=tmp;}}return !u?v<>= 1; } return ret; } vector divisor(ll x){ vector ans; for(ll i = 1; i * i <= x; i++){ if(x % i == 0) {ans.push_back(i); if(i*i!=x){ ans.push_back(x / ans[i]);}}}sor(ans); return ans; } ll pop(ll x){return __builtin_popcountll(x);} ll poplong(ll x){ll y=-1;while(x){x/=2;y++;}return y;} P hyou(P a){ll x=fastgcd(abs(a.fi),abs(a.se));a.fi/=x;a.se/=x;if(a.se<0){a.fi*=-1;a.se*=-1;}return a;} P Pplus(P a,P b){ return hyou({a.fi*b.se+b.fi*a.se,a.se*b.se});} P Ptimes(P a,ll b){ return hyou({a.fi*b,a.se});} P Ptimes(P a,P b){ return hyou({a.fi*b.fi,a.se*b.se});} P Pminus(P a,P b){ return hyou({a.fi*b.se-b.fi*a.se,a.se*b.se});} P Pgyaku(P a){ return hyou({a.se,a.fi});} void cincout() { ios::sync_with_stdio(false); std::cin.tie(nullptr); cout<< fixed << setprecision(10); } template vector NTT(vector a,vector b){ ll nmod=T::mod(); int n=a.size(); int m=b.size(); vector x1(n); vector y1(m); for(int i=0;i(x1,y1); auto z2=convolution<469762049>(x1,y1); auto z3=convolution<1224736769>(x1,y1); vector res(n+m-1); ll m1=167772161; ll m2=469762049; ll m3=1224736769; ll m1m2=104391568; ll m1m2m3=721017874; ll mm12=m1*m2%nmod; for(int i=0;i struct FormalPowerSeries:vector{ using vector::vector; using F=FormalPowerSeries; F &operator=(const vector &g){ int n=g.size(); int m=(*this).size(); (*this).resize(n); for(int i=0;i>=(const int d) { int n=(*this).size(); (*this).erase((*this).begin(),(*this).begin()+min(n, d)); return *this; } F operator*(const T &g) const { return F(*this)*=g;} F operator-(const T &g) const { return F(*this)-=g;} F operator+(const T &g) const { return F(*this)+=g;} F operator/(const T &g) const { return F(*this)/=g;} F operator*(const F &g) const { return F(*this)*=g;} F operator-(const F &g) const { return F(*this)-=g;} F operator+(const F &g) const { return F(*this)+=g;} F operator/(const F &g) const { return F(*this)/=g;} F operator%(const F &g) const { return F(*this)%=g;} F operator<<(const int d) const { return F(*this)<<=d;} F operator>>(const int d) const { return F(*this)>>=d;} F pre(int sz) const { return F(begin(*this), begin(*this) + min((int)this->size(), sz)); } F inv(int deg=-1) const { int n=(*this).size(); if(deg==-1) deg=n; assert(n>0&&(*this)[0]!=T(0)); F g(1); g[0]=(*this)[0].inv(); while(g.size()=0;i--){ (*this)[i+d]+=(*this)[i]*c; } } void onediv(const int d,const T c){ int n=(*this).size(); for(int i=0;i inv(n); inv[1]=1; for(int i=2;i=0;i--) ret[i+1]=(*this)[i]*inv[i+1]; ret[0]=0; return ret; } F log(int deg=-1) const { int n=(*this).size(); if(deg==-1) deg=n; assert((*this)[0]==T(1)); return ((*this).diff()*(*this).inv(deg)).pre(deg).integral(); } F exp(int deg=-1) const { int n=(*this).size(); if(deg==-1) deg=n; assert(n==0||(*this)[0]==0); F Inv; Inv.reserve(deg); Inv.push_back(T(0)); Inv.push_back(T(1)); auto inplace_integral = [&](F& f) -> void { const int n = (int)f.size(); int mod=T::mod(); while(Inv.size()<=n){ int i = Inv.size(); Inv.push_back((-Inv[mod%i])*(mod/i)); } f.insert(begin(f),T(0)); for(int i=1;i<=n;i++) f[i]*=Inv[i]; }; auto inplace_diff = [](F &f) -> void { if(f.empty()) return; f.erase(begin(f)); T coeff=1,one=1; for(int i=0;i((*this).size(),m)); x.resize(m); inplace_diff(x); x.push_back(T(0)); internal::butterfly(x); for(int i=0;i((*this).size(),2*m);i++) x[i]+=(*this)[i]; fill(begin(x),begin(x)+m,T(0)); internal::butterfly(x); for(int i=0;i<2*m;i++) x[i]*=y[i]; internal::butterfly_inv(x); for(int i=0;i<2*m;i++) x[i]*=si2; b.insert(end(b),begin(x)+m,end(x)); } return b.pre(deg); } F pow(ll m){ int n=(*this).size(); int x=0; while(x<(*this).size()&&(*this)[x]==T(0)){ x++; } if(x*m>=n){ F ret(n); return ret; } F f(n-x); T y=(*this)[x]; for(int i=x;i inv(n+1); inv[1]=1; for(int i=2;i<=n;i++) inv[i]=mod-inv[mod%i]*(mod/i); T x=1; for(int i=0;i division(F g){ F f=(*this); int n=f.size(); int m=g.size(); if(n multieva(vector p){ int m=p.size(); int n=(*this).size(); int M=1; int l=0; while(M> g(l+1); g[0].resize(m); for(int i=0;i>(i+1)); for(int j=0;j<(m>>(i+1));j++) g[i+1][j]=g[i][2*j]*g[i][2*j+1]; } g[l][0]=(*this).division(g[l][0]).se; for(int i=l;i>=1;i--){ for(int j=0;j<(m>>(i-1));j++){ g[i-1][j]=g[i][j/2].division(g[i-1][j]).se; } } for(int i=0;i ret(M); for(int i=0;i void GaussJordan(vector> &A,bool is_extended = false){ ll m=A.size(),n=A[0].size(); ll rank=0; for(int i=0;i void linear_equation(vector> a, vector b, vector &res) { ll m=a.size(),n=a[0].size(); vector> M(m,vector(n+1)); for(int i=0;i pair Characteristic_equation(const F &a) { using T=typename F::value_type; ll n=a.size(); ll p=n/2; ll u=p+(p+1); vector> f(u,vector(u)); f[0][0]=1; for(int i=1;i<=p;i++){ f[i][i-1]=-1; } for(int i=p;i b(u); b[0]=1; vector res(u); linear_equation(f,b,res); F X(p),Y(p+1); for(int i=0;i T getK(FormalPowerSeries p, FormalPowerSeries q,ll k){ if(p.size()==0) return 0; if(k==0) return p[0]/q[0]; if(p.size()>=q.size()){ p=p.division(q).se; } if(k<0) return T(0); ll d=q.size(); while(k){ auto qn=q; for(int i=1;i; using mint = modint998244353; constexpr ll MAX = 2000010; ll fac[MAX],finv[MAX],inv[MAX]; void COMinit(){ fac[0]=fac[1]=1; finv[0]=finv[1]=1; inv[1]=1; for(int i=2;i>n>>k; //f_0 = 1,f_1 = 1,f_n = f_{n-1} - x f_{n-2} mint ans=1; for(int i=n+1;i<=2*n;i++) ans*=i; for(int i=1;i<=n;i++) ans/=i; //f_{k+1}'/f_k - f_{k+2}'/f_{k+1} fps f(k+10),g(k+11),h(k+12); for(int i=0;i<(k+1)/2;i++){ f[i]=binom(k-1-i,i)*mint(-1).pow(i); } for(int i=0;i<(k+2)/2;i++){ g[i]=binom((k+1)-1-i,i)*mint(-1).pow(i); } for(int i=0;i<(k+3)/2;i++){ h[i]=binom((k+2)-1-i,i)*mint(-1).pow(i); } fps c=g; c=c.diff(); h=h.diff(); fps q=c/f-h/g; ans-=q[n]; cout<