//#pragma comment(linker,"/STACK:102400000,102400000") #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include #define PB push_back #define MP make_pair #define PF push_front #define lson k<<1 #define rson k<<1|1 using namespace std; typedef long long ll; typedef double db; typedef long double ldb; const int N = 1205; const ll MOD = 1000000007; ll f[N][N]; int a[N]; void Update(ll &now,ll val) { now += val; if(now>=MOD) now-=MOD; } int main() { #ifdef PKWV // freopen("in.in","r",stdin); #endif // PKWV int n; while(scanf("%d",&n)+1) { for(int i=0; i=0; i--) { for(int j=1; j<=n&&i+j<=n; j++) { bool ok(true); for(int k=1; ka[i+k]) ok=false; if(ok) { ll ajk = 1; for(int k=0; k<=j; k++) { Update(f[i][j],f[i+j][k]*ajk%MOD); ajk = ajk*(j-k)%MOD; } } } } ll res(0); for(int i=1; i<=n; i++) res+=f[0][i]; printf("%lld\n",res%MOD); } return 0; }