I,R=input,range N=int(I()) M=R(N) A=[[0]*N for i in R(N+1)] B=[0]*N S=I() P=998244353 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)*(pow(2,max(0,i-j-2),P)-A[i-j-1][j])+[A[i-1][j],pow(2,max(0,i-2),P)][1>j and S[N-i]>"0"])%P print(sum(pow(2,j,P)*A[N][j]for j in M)%P)