MOD = 998244353 N = int(input()) N2 = N // 2 S = input() X = [0] * (N2 + 1) X[0] = 1 level = 0 for i, s in enumerate(S): if s == "(": level += 1 for j in reversed(range(level)): X[j + 1] += X[j] X[j + 1] %= MOD else: for j in range(level): X[j] += X[j + 1] X[j] %= MOD X[level] = 0 level -= 1 print(X[0])