MOD = 998244353 N = int(input()) S = input() pos_1 = [] for i, c in enumerate(S): if c == '1': pos_1.append(i) ans = int(bool(pos_1)) for j in range(len(pos_1)-1): ans *= pos_1[j+1] - pos_1[j] + 1 ans %= MOD print(ans)