N = int(input()) S = input() p = 998244353 dp = [0] * (N + 1) dp[0] = 1 cum = [0] * (N + 1) cum[1] = 1 j = -1 for i, s in enumerate(S): if s == "1": j = i if j == -1: cum[i + 1] += cum[i] cum[i + 1] %= p continue cum[i + 1] = (cum[i] + dp[i]) % p dp[i + 1] = cum[j + 1] print(dp[N]) # print(dp) # print(cum)