MOD=998244353 N=int(input()) s=input() dp=[0,1] for i in range(N): ndp=[0]*(i+3) cum=[0]*(i+4) for j in range(i+2): dp[j]%=MOD if s[i]=="1": ndp[j+1]+=dp[j]*j else: ndp[j]+=dp[j]*(i+1-j) cum[j+1]-=dp[j] cum[1]+=dp[j] for j in range(1,i+4): cum[j]+=cum[j-1] ndp[j-1]+=cum[j-1] dp=ndp print(sum(dp))