MOD = 998244353 n = int(input()) S = input() dp = {0:1} for s in S: ndp = {} for rb, v in dp.items(): r = rb // n b = rb - r * n if s == "(": x = rb + n ndp[x] = ndp.get(x, 0) + v ndp[x] %= MOD x = rb + 1 ndp[x] = ndp.get(x, 0) + v ndp[x] %= MOD else: if r >= 1: x = rb - n ndp[x] = ndp.get(x, 0) + v ndp[x] %= MOD if b >= 1: x = rb - 1 ndp[x] = ndp.get(x, 0) + v ndp[x] %= MOD dp = ndp print(ndp.get(0, 0))