#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include using namespace std; ll dp[3030][3030]; const int MOD=998244353; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; string s; cin>>n>>s; dp[0][0]=1; vector S(n+1); rep(i,n){ if(s[i]=='(') S[i+1]=S[i]+1; else S[i+1]=S[i]-1; } rep(i,n){ rep(j,n+1){ if(s[i]=='('){ if(j+1<=S[i+1]) dp[i+1][j+1]=(dp[i+1][j+1]+dp[i][j])%MOD; if(S[i+1]-j>=0) dp[i+1][j]=(dp[i+1][j]+dp[i][j])%MOD; } else{ if(j-1>=0) dp[i+1][j-1]=(dp[i+1][j-1]+dp[i][j])%MOD; if(S[i+1]-j>=0) dp[i+1][j]=(dp[i+1][j]+dp[i][j])%MOD; } } } cout<