#include "stdio.h" #include "string.h" #define MOD ((long long)1e9+7) long long t,d[1210],dp[1210][1210],np[1210][1210],fac[1210]; long long countx; long long c(int n,int k){ if(k==0||k==n) return 1; if(np[n][k]!=-1) return np[n][k]; return np[n][k]=(c(n-1,k)+c(n-1,k-1))%MOD; } long long p(int n,int k){ return c(n,k)*fac[k]%MOD; } long long solve(long long n,long long k){ //printf("call: %lld %lld\n",n,k); if(n>t) return 1; if(dp[n][k]!=-1) return dp[n][k]; long long limit=n; for(long long i=n+1;d[i]>=d[i-1]&&i=d[i-1]&&i<=t;i++) limit=i; for(long long i=1;i<=limit;i++) countx+=solve(i+1,i),countx%=MOD;//,printf("check: %lld\n",countx); printf("%lld",countx); }