def rle(s): n = len(s) i = 0 r = [] while i < n: j = i while j < n and s[j] == s[i]: j += 1 r.append((s[i], j - i)) i = j return r n = int(input()) s = input().strip('0') n = len(s) ans = 1 for i, j in rle(s): if i == '0': ans = (ans * (j + 2)) % 998244353 else: ans = ans * pow(2, j - 1, 998244353) % 998244353 print(ans)