#include #include typedef long long ll; typedef unsigned long long ull; #define clr(ma) memset(ma,-1,sizeof ma) #define inf 1000000000000000ll #define vi vector #define pi pair #define T pair #define mk make_pair #define getBit(m,i) ((m&(1<::iterator #define itr2 map >::iterator #define id(k) scanf("%9lf",&k) #define fi(ss) freopen (ss,"r",stdin) #define fo(ss) freopen (ss,"w",stdout) #define clean(vis) memset(vis,0,sizeof vis) #define mo(x) ((x)=0?(x):(x)+P) #define fast ios_base::sync_with_stdio(0);cin.tie(0); #define sc(s) scanf("%s",s) using namespace std; const int N=1200+5; const ll M =1000*1000*1000+7; ll P [N][N]; ll dp [N][N]; int a [N]; int d [N]; int n; ll solve(int r,int id){ if (id==n)return 1; ll & res=dp[r][id]; if (res!=-1)return res; res=0; for (int i=1;i<=min((r==0?n:r),d[id]);i++){ if (r==0){ res+=solve(i,id+i); if (res>=M)res-=M; } else{ res+=(P[r][i]*solve(i,id+i))%M; if (res>=M)res-=M; } } return res; } int main(){ in(n); for (int i=1;i<=n;i++){ for (int j=0;j<=i;j++){ P[i][j]=(j==0)?1:((P[i][j-1]*(ll)(i-j+1))%M); // cout<a[j-1])d[i]++; else break; } // cout<