from heapq import heapify, heappop, heappush
import sys

int1 = lambda x: int(x) - 1

# input = lambda: sys.stdin.buffer.readline()
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
i1 = lambda: int1(input())
mi = lambda: map(int, input().split())
mi1 = lambda: map(int1, input().split())
li = lambda: list(mi())
li1 = lambda: list(mi1())
lli = lambda n: [li() for _ in range(n)]

INF = float("inf")
# mod = int(1e9 + 7)
mod = 998244353


n = ii()
a = [1 if c == "(" else -1 for c in input()]
dp = [0] * (n + 1)  # dp[x]= 赤の合計がxで青の合計がacc-x
dp[0] = 1
acc = 0
for i in range(n):
    nxt = [0] * (n + 1)
    for x in range(n + 1):
        y = acc - x
        if 0 <= x + a[i] <= n:
            nxt[x + a[i]] += dp[x]
            if nxt[x + a[i]] >= mod:
                nxt[x + a[i]] -= mod
        if 0 <= y + a[i] <= n:
            nxt[x] += dp[x]
            if nxt[x] >= mod:
                nxt[x] -= mod
    dp = nxt
    acc += a[i]
print(dp[0])