n = int(input()) s = input().strip('0') n = len(s) if n == 0: exit(print(0)) ans = 1 now = 0 mod = 998244353 for i in s: if i == '0': now += 1 else: ans = ans * (now + 2) % mod now = 0 print(ans * 499122177 % mod)