N=int(input()) S=list(map(int,list(input()))) if sum(S): 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 else: ans=0 print(ans)