N = int(input()) A = input() MOD = 998244353 dp = [1,0,0] for char in A: next_dp = [0,0,0] if char == '0': next_dp[0] = (dp[0]) % MOD next_dp[1] = (dp[1]) % MOD next_dp[2] = (dp[0] + dp[1] + dp[2]) % MOD else: next_dp[1] = (dp[0] + dp[1]) % MOD next_dp[2] = (dp[2]) % MOD dp = next_dp print(sum(dp) % MOD)