mod=998244353 n=int(input()) S=input() m=n//2+10 dp=[0]*m dp[0]=1 now=0 for s in S: dpn=[0]*m if s=='(': for i in range(now+1): dpn[i]+=dp[i] if i!=m-1: dpn[i+1]+=dp[i] now+=1 else: for i in range(now+1): dpn[i]+=dp[i] if i!=0: dpn[i-1]+=dp[i] now-=1 if now<0 or now>n//2+5: print(0) exit() dp=[i%mod for i in dpn] if now==0: print(dp[0]) else: print(0)