MOD = 998244353 N = int(input()) S = input() if '1' not in S: print(0) exit() ans = 1 lst = S.find('1') for i in range(lst + 1, N): if S[i] == '1': ans *= i - lst + 1 ans %= MOD lst = i print(ans)