#include #if __has_include() #include #endif namespace ttl{ using namespace std; using f80=long double; using i64=int64_t; using u64=uint64_t; template struct mymodint{ i64 vl; static constexpr i64 get_mod(){ return mod; } i64 val(){ return vl; } mymodint(i64 vl_=0):vl(vl_%mod){} mymodint operator-(){ return (vl==0)?0:mod-vl; } mymodint operator+(mymodint rhs){ return mymodint(*this)+=rhs; } mymodint operator-(mymodint rhs){ return mymodint(*this)-=rhs; } mymodint operator*(mymodint rhs){ return mymodint(*this)*=rhs; } mymodint operator/(mymodint rhs){ return mymodint(*this)/=rhs; } mymodint pow(i64 rhs){ mymodint res=1,now=(*this); while(rhs){ res*=((rhs&1)?now:1),now*=now,rhs>>=1; } return res; } mymodint& operator+=(mymodint rhs){ vl+=rhs.vl,vl-=((vl>=mod)?mod:0); return (*this); } mymodint& operator-=(mymodint rhs){ vl+=((vl using modint= #if __has_include() atcoder::static_modint; #else mymodint; #endif template std::ostream& operator<<(std::ostream& os,modint x){ return os<<(x.val()); } template std::istream& operator>>(std::istream& is,modint& x){ i64 t; is>>t,x=t; return is; } template void scn_(T& a){ cin>>a; } template void scn_(pair& a){ scn_(a.first),scn_(a.second); } template void scn_(vector& a){ for(auto& v:a){ scn_(v); } } template void scn_(vector>& a){ for(auto& v:a){ for(auto& u:v){ cin>>u; } } } void scn(){} template void scn(T& n,Args&... args){ scn_(n),scn(args...); } template void prt_(T a){ cout< void prt_(pair a){ cout<<"{"< void prt(vector a){ for(size_t i=0;i void prt(vector> a){ for(auto& v:a){ for(size_t i=0;i void prt(T a){ prt_(a),cout<<"\n"; } template void prt(T a,Args... args){ prt_(a),cout<<" ",prt(args...); } template struct multi_dim_vector{ using type=vector::type>; }; template struct multi_dim_vector{ using type=T; }; template vector mvec(int n,Arg&& arg){ return vector(n,arg); } template class multi_dim_vector::type mvec(int n,Args&&... args){ return typename multi_dim_vector::type(n,mvec(args...)); } template void rev(T& a){ reverse(a.begin(),a.end());} template void srt(T& a){ sort(a.begin(),a.end()); } template void rsrt(T& a){ sort(a.rbegin(),a.rend()); } template T revd(T a){ reverse(a.begin(),a.end()); return a; } template T srtd(T a){ sort(a.begin(),a.end()); return a; } template T rsrtd(T a){ sort(a.rbegin(),a.rend()); return a; } template T summ(vector a){ return accumulate(a.begin(),a.end(),T(0)); } template T maxi(vector a){ return *max_element(a.begin(),a.end()); } template T mini(vector a){ return *min_element(a.begin(),a.end()); } template void chmx(T& a,T b){ a=max(a,b); } template void chmn(T& a,T b){ a=min(a,b); } i64 ppcnt(u64 k){ return __builtin_popcountll(k); } template T powe(T a,i64 n){ T res=1; while(n){ if(n&1){ res*=a; } a*=a; n/=2; } return res; } i64 powe(i64 a,i64 n,i64 m){ i64 res=1; while(n){ if(n&1){ res=res*a%m; } a=a*a%m; n/=2; } return res; } template void zip(vector& a){ auto b=srtd(a); b.erase(unique(b.begin(),b.end()),b.end()); map mp; for(int i=0;i1){ i64 mid=(ok+ng)/2; (mid*mid<=n?ok:ng)=mid; } return ok; } i64 sqrc(i64 n){ i64 ok=1e9+5,ng=0; while(std::abs(ok-ng)>1){ i64 mid=(ok+ng)/2; (mid*mid>=n?ok:ng)=mid; } return ok; } i64 dvf(i64 a,i64 b){ if(b<0){ a*=-1,b*=-1; } if(a<0){ return -(-a+b-1)/b; } return a/b; } i64 dvc(i64 a,i64 b){ if(b<0){ a*=-1,b*=-1; } if(a<0){ return -(-a)/b; } return (a+b-1)/b; } vector bfs(vector> G,int v){ int N=G.size(); vector dst(N,-1); queue q; dst[v]=0; q.emplace(v); while(q.size()){ int t=q.front(); q.pop(); for(auto u:G[t]){ if(dst[u]==-1){ dst[u]=dst[t]+1; q.emplace(u); } } } return dst; } vector dijkstra(vector>>& G,int s){ int N=G.size(); vector dst(N,1e18); dst[s]=0; priority_queue,vector>,greater>> pq; pq.emplace(0,s); vector f(N); while(pq.size()){ auto [t,u]=pq.top(); pq.pop(); if(f[u]){ continue; } f[u]=1; for(auto [v,w]:G[u]){ if(dst[v]>dst[u]+w){ dst[v]=dst[u]+w; pq.emplace(dst[v],v); } } } return dst; } vector> pfct(i64 n){ vector> res; for(i64 i=2;i*i<=n;++i){ if(n%i!=0){ continue; } i64 ex=0; while(n%i==0){ ex++,n/=i; } res.emplace_back(i,ex); } if(n!=1){ res.emplace_back(n,1); } return res; } vector ediv(i64 n){ vector res; for(i64 i=1;i*i<=n;++i){ if(n%i!=0){ continue; } res.emplace_back(i); if(i*i!=n){ res.emplace_back(n/i); } } srt(res); return res; } template struct csm2d{ int n,m; vector> a,c; csm2d(vector> a_):n(a_.size()),m(a_[0].size()),a(a_){ auto b=mvec(n,m+1,0); for(int i=0;i(n+1,m+1,0); for(int j=0;j auto runlng(T a) -> vector>{ int n=a.size(); vector> res; typename decltype(a)::value_type now=a[0]; i64 l=1; for(int i=1;i struct cmb{ vector fac,ifac; cmb(int mx=3000000):fac(mx+1,1),ifac(mx+1,1){ for(int i=1;i<=mx;++i){ fac[i]=fac[i-1]*i; } ifac[mx]/=fac[mx]; for(int i=mx;i>0;--i){ ifac[i-1]=ifac[i]*i; } } T operator()(i64 n,i64 k){ if(n<0||k<0||n struct Poly{ vector val; Poly():val({0}){} Poly(mint t):val({t}){} Poly(int siz):val(max(1,siz)){} Poly(initializer_list init):val(init){} Poly(vector init):val(init){} mint &operator[](int i){ return val[i]; } int size(){ return val.size(); } void resize(int siz){ val.resize(siz); } void shrink(){ for(int i=val.size()-1;i>0;--i){ if(val[i]==0){ val.pop_back(); } else{ return; } } } Poly operator+(Poly rhs){ return Poly(*this)+=rhs; } Poly operator-(Poly rhs){ return Poly(*this)-=rhs; } Poly operator*(Poly rhs){ return Poly(*this)*=rhs; } Poly operator/(Poly rhs){ return Poly(*this)/=rhs; } Poly operator%(Poly rhs){ return Poly(*this)%=rhs; } Poly operator-(){ for(mint& v:val){ v=mint(0)-v; } return (*this); } Poly operator+=(Poly rhs){ resize(max(this->size(),rhs.size())); for(int i=0;isize(),rhs.size())); for(int i=0;i MultiEval(vector a){ int siz=1; while(siz t(siz*2-1,{1}); for(int i=0;i=0;--i){ t[i]=t[2*i+1]*t[2*i+2]; } vector g(siz*2-1); g[0]=(*this)%t[0]; for(int i=1;i res(a.size()); for(int i=0;i C(val.size()); vector g(val.size()); mint now=1; for(size_t i=0;i x,vector y){ int N=x.size(); vector h(N); for(int i=0;i t=g_.MultiEval(x); for(int i=0;i den(2*N-1),num(2*N-1,{1}); for(int i=0;i=0;--i){ den[i]=den[2*i+1]*den[2*i+2]; num[i]=num[2*i+1]*den[2*i+2]+num[2*i+2]*den[2*i+1]; } (*this)=num[0]; } }; template struct FPS{ vector val; FPS():val({0}){} FPS(mint t):val({t}){} FPS(int siz):val(max(1,siz)){} FPS(initializer_list init):val(init){} FPS(vector init):val(init){} mint &operator[](int i){ return val[i]; } int size(){ return val.size(); } void resize(int siz){ val.resize(siz); } FPS& resize_(int siz){ auto tmp=val; tmp.resize(siz); return (*this)=tmp; } FPS operator-(){ for(mint& v:val){ v=mint(0)-v; } return (*this); } FPS& operator+=(mint rhs){ val[0]+=rhs; return (*this); } FPS& operator-=(mint rhs){ val[0]-=rhs; return (*this); } FPS& operator*=(mint rhs){ for(auto& v:val){ v*=rhs; } return (*this); } FPS& operator/=(mint rhs){ for(auto& v:val){ v/=rhs; } return (*this); } FPS operator+(mint rhs){ return FPS(*this)+=rhs; } FPS operator-(mint rhs){ return FPS(*this)-=rhs; } FPS operator*(mint rhs){ return FPS(*this)*=rhs; } FPS operator/(mint rhs){ return FPS(*this)/=rhs; } FPS& operator+=(FPS rhs){ resize(max(this->size(),rhs.size())); for(size_t i=0;isize(),rhs.size())); for(size_t i=0;i>=(int k){ if(int(val.size())<=k){ return (*this)={0}; } FPS res=val; res.val.erase(res.val.begin(),res.val.begin()+k); return (*this)=res; } FPS& operator<<=(int k){ FPS res=val; res.val.insert(res.val.begin(),k,mint(0)); return (*this)=res; } FPS operator+(FPS rhs){ return FPS(*this)+=rhs; } FPS operator-(FPS rhs){ return FPS(*this)-=rhs; } FPS operator*(FPS rhs){ return FPS(*this)*=rhs; } FPS operator/(FPS rhs){ return FPS(*this)/=rhs; } FPS operator%(FPS rhs){ return FPS(*this)%=rhs; } FPS operator<<(int k){ return FPS(*this)<<=k; } FPS operator>>(int k){ return FPS(*this)>>=k; } FPS shrink(){ for(int i=val.size()-1;i>0;--i){ if(val[i]==0){ val.pop_back(); } else{ break; } } return (*this); } FPS diff_(){ if(val.size()==1){ return (*this)={0}; } FPS f(val.size()-1); for(size_t i=1;i>t; if(f[0]==0){ f={0},f.resize(mx); return f; } mint c=f[0]; f/=c; (f.log(mx)*=mint(k)).exp(mx)*=(c.pow(k)); if(k==0?true:(t<=mx/k)){ f<<=t*k; f.resize(mx); return f; } else{ f={0},f.resize(mx); return f; } } FPS& diff(){ return (*this)=diff_(); } FPS& integral(){ return (*this)=integral_(); } FPS& inv(i64 mx=-1){ return (*this)=inv_(mx); } FPS& exp(i64 mx=-1){ return (*this)=exp_(mx); } FPS& log(i64 mx=-1){ return (*this)=log_(mx); } FPS& pow(i64 k,i64 mx=-1){ return (*this)=pow_(k,mx); } }; template T Product(vector a){ int siz=1; while(siz res(siz*2-1,{1}); for(size_t i=0;i=0;--i){ res[i]=res[2*i+1]*res[2*i+2]; } return res[0]; } template vector StirlingNumber2(int N){ FPS f(N+1),g(N+1); mint fact=1; for(int i=0;i<=N;++i){ f[i]=(mint(i).pow(N))/fact; g[i]=(mint(-1).pow(i))/fact; fact*=i+1; } f*=g; vector res(N+1); for(int i=0;i<=N;++i){ res[i]=f[i]; } return res; } template T Even(T f){ T g((f.size()+1)/2); for(size_t i=0;i<(f.size()+1)/2;++i){ g[i]=f[i*2]; } return g; } template T Odd(T f){ T g(f.size()/2); for(size_t i=0;i T Minus(T f){ for(size_t i=1;i mint BostanMori(FPS f,FPS g,i64 k){ while(k>0){ if(k%2==0){ f=Even(f*Minus(g)); } else{ f=Odd(f*Minus(g)); } g=Even(g*Minus(g)); k/=2; } return f[0]/g[0]; } template vector SubsetSum(int N,vector A,int T){ vector C(T+1); for(int i=0;i f(T+1); for(int k=1;k<=T;++k){ for(int i=1;i*k<=T;++i){ f[i*k]-=C[k]/i*(i%2?-1:1); } } f.exp(); vector res(T+1); for(int i=0;i<=T;++i){ res[i]=f[i]; } return res; } template vector Montmort(int N){ vector res(N+1); res[0]=1,res[1]=0; for(int n=2;n<=N;++n){ res[n]=(res[n-2]+res[n-1])*(n-1); } return res; } int main(){ constexpr u64 mod=998244353; using mint=modint; cmb Cb; int N; scn(N); FPS f(N+1); f[0]=1,f[1]=-4,f[2]=2; f.pow(N/2); if(N&1){ FPS g={1,-1}; f*=g; } mint ans=0; for(int i=0;i<=N;++i){ ans+=Cb.f(N-i)*f[i]; } auto a=Montmort(N); prt(Cb.f(N)-a[N]-a[N]+ans); }