#include using namespace std; #define rep(i,n) for(int (i) = 0 ; (i) < (int)(n) ; (i)++) #define REP(i,a,b) for(int (i) = a ; (int)(i) <= (int)(b) ; (i)++) #define all(n) (n).begin(),(n).end() typedef long long ll; typedef vector Vi; typedef vector VVi; typedef pair Pii; typedef vector VPii; int mod = 1000000007; int N; int dp[1010][1010][2][2]; int f(int n,int adj,int n2n4,int n1n3){ if( adj < 0 ) return 0; int &dv = dp[n][adj][n2n4][n1n3]; if( n == N ) return adj == 0 && n2n4 == 0 && n1n3 == 0; if( dv != -1 ) return dv; int d_n2 = 2 - n2n4; long long ans = 0; if( n2n4 ) ans += f(n+1,adj ,n1n3,1); if( n1n3 ) ans += f(n+1,adj+n2n4,0,0); ans += d_n2 * f(n+1,adj+n2n4,n1n3,1); int nopro = n + 1 - adj - n2n4 - n1n3 - d_n2; ans += nopro * f(n+1,adj+n2n4,n1n3,0); ans += adj * f(n+1,adj-1+n2n4,n1n3,0); return dv = ans % mod; } int main(){ cin >> N; if( N == 1 ){ cout << 1 << endl; }else{ memset(dp,-1,sizeof(dp)); cout << (f(2,0,0,0) * 2) %mod << endl; } }