#include using namespace std; #define MYMAXI 1200 #define MOD 1000000007 int M[MYMAXI]; long long cache[MYMAXI+1][MYMAXI+1]; long long facty[MYMAXI+1]; long long combination[MYMAXI+1][MYMAXI+1]; void myfactyorial() { long long v = 1LL; facty[0] = 1; for (int i=1; i<=MYMAXI; ++i) { facty[i] = v = (v * i) % MOD; } } long long myfunction(int n, int m) { if (combination[n][m] >= 0) { return combination[n][m]; } if (n < m) { return 0; } if (m == 0) { combination[n][m] = 1LL; } else { combination[n][m] = (myfunction(n-1, m-1) + myfunction(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