#include <bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define ll long long
#define Mid ((L+R)/2);
#define rev(x) reverse(x.begin(),x.end())
#define sortt(x) sort(x.begin(),x.end())
#define deb(x) cout<<#x<<"="<<x<<endl
#define pans(x) x ? cout<<"YES"<<"\n" :cout<<"NO"<<"\n";
#define AB ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define stldeb(x) {cout<< #x << " = " ;for(auto it : x)cout<< it << " ";cout<< endl;}
#define stlpdeb(x){cout<< #x << " : " <<endl;for(auto p : x) cout<<p.fr<< " " <<p.sc<<endl;}
using namespace std;
ll Min=-1e18;
ll Max=1e18;
int mod=1e9+7;
int n;
string s="((())";
int dp[1010][1010][7];
int solve(int i,int open,int j)
{
if((i-open)>open)
{
return 0;
}
if(i==n)
{
if((i-open)!=open || j!=5)
return 0;
return 1;
}
int &ret=dp[i][open][j];
if(ret!=-1)
return ret;
ret=0;
if(j==5)
{
ret=(ret+solve(i+1,open+1,j))%mod;
ret=(ret+solve(i+1,open,j))%mod;
}
else if(j!=0)
{
ret=(ret+solve(i+1,open+(s[j]=='('),j+1))%mod;
}
else
{
ret=(ret+solve(i+1,open+1,j))%mod;
ret=(ret+solve(i+1,open,j))%mod;
ret=(ret+solve(i+1,open+(s[j]=='('),j+1))%mod;
}
return ret;
}
int main()
{
AB
cin>>n;
for(int i=0;i<=n+1;i++)
for(int j=0;j<=n+1;j++)
for(int k=0;k<=6;k++)
dp[i][j][k]=-1;
cout<<solve(0,0,0)<<"\n";
}
Copy