# -*- coding: utf-8 -*- N=int(input()) S=input() MOD=998244353 ans=0 t=0 for i in range(N): if S[i]=="1": if ans==0: ans=1 else: ans*=t+2 ans%=MOD t=0 else: t+=1 print(ans)