#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a struct Mint{ T v; Mint():v(0){} Mint(signed v):v(v){} Mint(long long t){v=t%MOD;if(v<0) v+=MOD;} Mint pow(long long k){ Mint res(1),tmp(v); while(k){ if(k&1) res*=tmp; tmp*=tmp; k>>=1; } return res; } Mint inv(){return pow(MOD-2);} Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;} Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;} Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;} Mint& operator/=(Mint a){return (*this)*=a.inv();} Mint operator+(Mint a) const{return Mint(v)+=a;}; Mint operator-(Mint a) const{return Mint(v)-=a;}; Mint operator*(Mint a) const{return Mint(v)*=a;}; Mint operator/(Mint a) const{return Mint(v)/=a;}; Mint operator-(){return v?MOD-v:v;} bool operator==(const Mint a)const{return v==a.v;} bool operator!=(const Mint a)const{return v!=a.v;} bool operator <(const Mint a)const{return v >n; using M = Mint; vector dp(n+1,1); dp[0]=M(0); for(int i=n-2;i>=0;i--){ vector sm(n+1,0); for(int j=1;j<=n;j++) sm[j]=sm[j-1]+dp[j]; int k=i?i:1; vector nx(n+1,0); for(int j=1;j<=n;j++) nx[j]=sm[n]-sm[max(0,j-k)]; swap(dp,nx); } M ans; for(int j=1;j<=n;j++) ans+=dp[j]; for(int j=1;j<=n;j++) dp[j]=0; dp[n]=M(1); for(int i=n-2;i>=0;i--){ vector sm(n+1,0); for(int j=1;j<=n;j++) sm[j]=sm[j-1]+dp[j]; int k=i?i:1; vector nx(n+1,0); for(int j=1;j<=n;j++) nx[j]=sm[n]-sm[max(0,j-k)]; swap(dp,nx); } ans-=dp[1]; cout<