using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static void Main() { var n = NN; var s = ReadLine(); WriteLine(Brac(n, s)); } static long Brac(int n, string s) { var dp = new int[n]; dp[0] = 1; for (var i = 1; i < n; ++i) { if (s[i] == '(') dp[i] = dp[i - 1] + 1; else dp[i] = dp[i - 1] - 1; } var br = new long[s.Length / 2 + 1]; br[0] = 1; for (var i = 0; i < s.Length; ++i) { var next = (long[]) br.Clone(); if (s[i] == '(') { for (var j = 0; j + 1 < br.Length; ++j) next[j + 1] = (next[j + 1] + br[j]) % mod; } else { for (var j = 1; j < br.Length; ++j) next[j - 1] = (next[j - 1] + br[j]) % mod; } for (var j = dp[i] + 1; j < next.Length; ++j) next[j] = 0; br = next; } return br[0]; } static int mod = 998_244_353; }