N = int(input()) S = input() cum = [0]*(N+1) for i in range(N): cum[i+1]=cum[i]+int(S[i]) cnt = [0]*(N+1) for ci in cum: cnt[ci]+=1 c1 = cum[-1] dp = [0]*(N+1) ; dp[0]=1 cum_dp = [0]*(N+1) ; cum_dp[0]=1 mod = 998244353 for i in range(1,N+1): dp[i] = (cum_dp[i-1]*cnt[i]) % mod cum_dp[i] = (cum_dp[i-1]+dp[i]) % mod print(cum_dp[c1-1])