import java.io.*; import java.util.*; public class Main { static final int MOD = 998244353; static ArrayList>> dp = new ArrayList<>(); static char[] parens; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); parens = sc.next().toCharArray(); for (int i = 0; i < n; i++) { dp.add(new HashMap<>()); } 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.get(idx).containsKey(red)) { dp.get(idx).put(red, new HashMap<>()); } if (!dp.get(idx).get(red).containsKey(blue)) { if (parens[idx] == '(') { if (red == blue) { dp.get(idx).get(red).put(blue, dfw(idx - 1, red - 1, blue) * 2 % MOD); } else { dp.get(idx).get(red).put(blue, (dfw(idx - 1, red - 1, blue) + dfw(idx - 1, red, blue - 1)) % MOD); } } else { if (red == blue) { dp.get(idx).get(red).put(blue, dfw(idx - 1, red, blue + 1) * 2 % MOD); } else { dp.get(idx).get(red).put(blue, (dfw(idx - 1, red + 1, blue) + dfw(idx - 1, red, blue + 1)) % MOD); } } } return dp.get(idx).get(red).get(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(); } }