import java.io.*; import java.util.*; public class Main { static final int MOD = 998244353; static int[][][] dp; static char[] parens; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); parens = sc.next().toCharArray(); dp = new int[n][n / 2 + 1][n / 2 + 1]; for (int[][] arr1 : dp) { for (int[] arr2 : arr1) { Arrays.fill(arr2, -1); } } System.out.println(dfw(n - 1, 0, 0)); } static int dfw(int idx, int red, int blue) { if (red < 0 || blue < 0) { return 0; } if (idx < 0) { if (red == 0 && blue == 0) { return 1; } else { return 0; } } if (dp[idx][red][blue] < 0) { if (parens[idx] == '(') { dp[idx][red][blue] = (dfw(idx - 1, red - 1, blue) + dfw(idx - 1, red, blue - 1)) % MOD; } else { dp[idx][red][blue] = (dfw(idx - 1, red + 1, blue) + dfw(idx - 1, red, blue + 1)) % MOD; } } return dp[idx][red][blue]; } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }