I,R=input,range N=int(I()) A=[[0]*N for i in R(N+1)] B=[0]*N S=I() P=998244353 p=[pow(2,i,P)for i in R(N)] for i in R(1,N+1): s=S[N-i]>"0" for j in R(i):A[i][j]=B[j]=(B[j]+(S[N-i]>"0" and j>0)*(p[max(0,i-j-2)]-A[i-j-1][j])+[A[i-1][j],p[max(0,i-2)]][1>j and S[N-i]>"0"])%P print(sum(p[j]*A[N][j]for j in R(N))%P)