#include #define MOD 1000000007 using namespace std; char cresc[1210][1210]; long long int dp[1210][1210]; void gcd(unsigned long long int *x, unsigned long long int *y, unsigned long long int a, unsigned long long int b) { if (a == 0) { *x = 0, *y = 1; return; } unsigned long long int x1, y1; gcd( &x1, &y1,b%a, a); *x = (y1 - (b/a) * x1); *y = x1; } unsigned long long int invers(unsigned long long int n){ unsigned long long int x=n; unsigned long long int y; gcd(&x, &y, n, MOD); return (x+MOD)%MOD; } int main() { int n; int m[1210]; cin>>n; for(int i=0; i>m[i]; for(int i=0; i=0; s--){ for(int k=2; k<=n-s; k++){ if(cresc[s][k]==1){ for(int a=1; a<=k; a++){ dp[k][s] = ( dp[k][s] + ((fac[k] * invfac[k-a] )%MOD * dp[a][s+k])%MOD )%MOD ; } } } } long long int sol=0L; for(int i=1; i<=n; i++){ //cout<