# coding: utf-8 # Your code here! N=int(input()) S=input() MOD=998244353 if "1" not in S: print(0) exit() ans=1 count=-1 for s in S: if s=="1": if count==-1: count=0 else: ans*=(count+2) ans%=MOD count=0 else: if count==-1: pass else: count+=1 print(ans)