import sys, time, random from collections import deque, Counter, defaultdict input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 63 - 1 mod = 998244353 n = ii() s = input() if '1' not in s: print(0) else: bef = -1 ans = 1 for i in range(n): if s[i] == '1': if bef == -1: bef = i else: ans *= (i - bef + 1) ans %= mod bef = i print(ans)