#include #include #include #include #include #include #include #define MAXN 1200 #define MOD 1000000007 int M[MAXN]; long dp[MAXN+1][MAXN+1]; long fact[MAXN+1]; long combination[MAXN+1][MAXN+1]; void cal_factor() { long v = 1; fact[0] = 1; for (int i=1; i<=MAXN; ++i) { fact[i] = v = (v * i) % MOD; } } long cal_combi(int n, int m) { if (combination[n][m] >= 0) { return combination[n][m]; } if (n < m) { return 0; } if (m == 0) { combination[n][m] = 1; } else { combination[n][m] = (cal_combi(n-1, m-1) + cal_combi(n-1, m)) % MOD; } return combination[n][m]; } int main() { int n; scanf("%d", &n); for (int i=0; i=0; --i) { int mx = 0, last = -1; for (int j=i; j