#include #include #include #include #include #include using namespace std; const long long MOD=998244353; long long f[1001][1001],c[1001][1001]; long long fc[1001]; long long ans[1001]; bool added[1001][1001]; long long LLL(long long x) { return 0; return max(0LL, x/3LL-1LL); } long long RRR(long long x) { return x; return min(x, x/2LL + 3LL); } main() { long long q; cin>>q; vector zz[1001]; f[0][0]=1; zz[0].push_back(0); for (int i=0;i<=q;i++) for (int j=0;j<=i;j++) { if (j==0) c[i][j]=1; else if (i==j) c[i][j]=1; else if (j==1) c[i][j]=i; else c[i][j]=(c[i-1][j-1]+c[i-1][j])%MOD; } for (int n=1;n<=q;n++) { for (int first=1;first<=((n+1)/2);first++) { int Lside=max(0,first-2); int Rside=max(0,n-first-1); for (int Ltake : zz[Lside]) // optimize for (int Rtake : zz[Rside]) // optimize { long long val=(f[Lside][Ltake]*f[Rside][Rtake]*c[Ltake+Rtake][Ltake])%MOD; if ( first < (n-first+1) ) val=(val*2LL)%MOD; f[n][1+Ltake+Rtake]+=val; f[n][1+Ltake+Rtake]%=MOD; if (!added[n][1+Ltake+Rtake]) { added[n][1+Ltake+Rtake]=true; zz[n].push_back(1+Ltake+Rtake); } } } //for (int k=0;k<=n;k++) // if (f[n][k]) zz[n].push_back(make_pair(k,f[n][k])); //cout<<"done "< "<