#include #include #include #include #include #include #include using namespace std; typedef long long ll; const ll MOD = 1000000007; ll dp[3000][3000]; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; int N; cin >> N; ll ans = 0; if(N <= 2){ cout << 0 << endl; } // 大 -> 小 for(int i = 0; i < N; i++) dp[0][i] = 1; for(int i = 1; i < N; i++){ for(int j = 0; j < N; j++){ // a[i-1] > a[i] if(i%2 == 0){ // (i-1, j) -> (i, 0 ~ j-1) dp[i][0] += dp[i-1][j]; dp[i][j] -= dp[i-1][j]; // a[i-1] < a[i] }else{ // (i-1, j) -> (i, j ~ N-i-1) dp[i][j] += dp[i-1][j]; dp[i][N-i] -= dp[i-1][j]; } } dp[i][0] %= MOD; for(int j = 1; j < N; j++){ dp[i][j] += dp[i][j-1]; dp[i][j] %= MOD; } } ans += dp[N-1][0]; // 小 -> 大 for(int i = 0; i < N; i++){ for(int j = 0; j < N; j++){ dp[i][j] = 0; } } for(int i = 0; i < N; i++) dp[0][i] = 1; for(int i = 1; i < N; i++){ for(int j = 0; j < N; j++){ // a[i-1] > a[i] if(i%2 == 1){ // (i-1, j) -> (i, 0 ~ j-1) dp[i][0] += dp[i-1][j]; dp[i][j] -= dp[i-1][j]; // a[i-1] < a[i] }else{ // (i-1, j) -> (i, j+1 ~ N-i-1) dp[i][j] += dp[i-1][j]; dp[i][N-i] -= dp[i-1][j]; } } dp[i][0] %= MOD; for(int j = 1; j < N; j++){ dp[i][j] += dp[i][j-1]; dp[i][j] %= MOD; } } ans += dp[N-1][0]; cout << (ans+MOD)%MOD << endl; }