#include using namespace std; using ll=long long; #define int ll #define rng(i,a,b) for(int i=int(a);i=a;i--) #define per(i,b) gnr(i,0,b) #define pb push_back #define eb emplace_back #define a first #define b second #define bg begin() #define ed end() #define all(x) x.bg,x.ed #ifdef LOCAL #define dmp(x) cerr<<__LINE__<<" "<<#x<<" "< void chmax(t&a,u b){if(a void chmin(t&a,u b){if(a>b)a=b;} template using vc=vector; template using vvc=vc>; using pi=pair; using vi=vc; template ostream& operator<<(ostream& os,const pair& p){ return os<<"{"< ostream& operator<<(ostream& os,const vc& v){ os<<"{"; for(auto e:v)os<>=1; } return res; } mint inv()const{return pow(mod-2);} friend ostream& operator<<(ostream&os,const mint&m){ return os< p_recursive(const vc&a,int d){ int n=a.size(); int k=(n+2)/(d+1); int m=k*d; vvc x(m,vc(m+m-1)); rep(p,m-1)rep(i,k){ mint w=a[p+i]; rep(j,d){ x[i*d+j][p]=w; w*=(p+i); } } rep(i,m) x[i][m-1+i]=1; vc v; rep(i,m){ int j=0; while(j res=vvc(int(v.size()+d-1)/d,vc(d)); rep(i,v.size()) res[i/d][i%d]=v[i]; return res; } vc extend_sequence(const vc&a,const vvc& f,int n){ int k=f.size(),d=f[0].size(); assert(int(a.size())>=k-1); vc res(n),w(k); rep(i,n){ if(i calc(int n){ vc res(n+1); res[1]=1; dp[2][0][0][0]=2; rng(i,2,n+1){ res[i]=dp[i][0][0][0]; rep(j,i){ rep(p,2)rep(q,2){ mint a=p==0?j:j-1; mint b=p==0?2:1; mint c=p==0?0:1; mint d=mint(i+1)-a-b-c; if(j){ if(q==0){ dp[i+1][j-1][q][0]+=dp[i][j][p][q]*a; }else{ dp[i+1][j-1][q][0]+=dp[i][j][p][q]*(a-1); dp[i+1][j-1][0][0]+=dp[i][j][p][q]; } } dp[i+1][j+1][q][1]+=dp[i][j][p][q]*b; dp[i+1][j][q][1]+=dp[i][j][p][q]*c; dp[i+1][j][q][0]+=dp[i][j][p][q]*d; } } } return res; } signed main(){ cin.tie(0); ios::sync_with_stdio(0); cout<>n; cout<