import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### n = ni() s = [[-1,1][i == "("]for i in input()] d = [0] for i in range(n): d.append(d[-1] + s[i]) dp = [[0 for j in range(n//2+1)]for i in range(n+1)] dp[0][0] = 1 mod = 998244353 for i in range(n): for j in range(n//2+1): now = dp[i][j] if now == 0: continue ni = i + 1 # () nj = j + s[i] nk = d[i+1] - nj if 0 <= nj <= n//2 and 0 <= nk <= n//2: dp[ni][nj] += now dp[ni][nj] %= mod # [] nj = j nk = d[i+1] - nj if 0 <= nj <= n//2 and 0 <= nk <= n//2: dp[ni][nj] += now dp[ni][nj] %= mod print(dp[-1][0])