N=int(input()) S=list(map(int,list(input()))) idx=[] for i in range(N): if S[i]: idx.append(i) mod=998244353 ans=1 for l,r in zip(idx,idx[1:]): ans*=r-l+1 ans%=mod print(ans)