import sys input = lambda: sys.stdin.readline().strip() def Map(): return list(map(int,input().split())) N = int(input()) S = input() mod = 998244353 ans = 1 f = 0 c = 0 for i in range(N): if f: if S[i] == '1': ans *= (c+1) ans %= mod c = 1 else: c += 1 else: if S[i] == '1': f = 1 c = 1 if f == 0: ans = 0 print(ans)