#include #include #include #include #include #include #include #include #include #include #include using namespace std; #define X first #define Y second #define N 1210 typedef long long ll; typedef pair pii; const int INF=1<<30; const int Mod=1000000000+7; int n; int a[N],dp[N][N],c[N][N],A[N][N],fac[N]; int Solve(int p,int k) { if (p>n) return 1; if (dp[p][k]!=-1) return dp[p][k]; int &res=dp[p][k]=0; for (int i=p;i<=n && i-p+1<=k;i++) { if (i!=p && a[i]=Mod) res-=Mod; } return res; } int main() { //freopen("in.in","r",stdin); //freopen("out.out","w",stdout); fac[0]=1; for (int i=1;i=Mod) res-=Mod; } printf("%d\n",res); return 0; }