#include #include #include #include #include #include using namespace std; typedef long long LL; const int MAXN = 4000100; const int MOD = 998244353; int M, n; char op[MAXN]; LL sum[MAXN]; LL pian(int x, int i, int st, int len) { if(i>=n){ if(st+n-1!=i || len!=1)__builtin_trap(); return st==x?1:0; } if(x=st+len)return 0; int half = len>>1; LL kl = pian(x,i*2,st,half); LL kr = pian(x,i*2+1,st+half,half); if(op[i-1]=='0') return (kl+kr)%MOD; return (sum[i*2]*kr + kl*sum[i*2+1])%MOD; } int main() { int Q; scanf("%d%d",&M,&Q); scanf("%s",op); n = 1<<(M-1); for(int i=1;i<=n;++i)sum[i+n-1]=i; for(int i=n-1;i>=1;--i){ sum[i] = (op[i-1]=='0') ? ((sum[i*2]+sum[i*2+1]) % MOD) : ((sum[i*2]*sum[i*2+1]) % MOD); } while(Q--){ int t,x,y; scanf("%d%d",&t,&x); if(t==1){ scanf("%d",&y); x+=n-1; sum[x]=y; for(int i=x>>1;i;i>>=1){ sum[i] = (op[i-1]=='0') ? ((sum[i*2]+sum[i*2+1]) % MOD) : ((sum[i*2]*sum[i*2+1]) % MOD); } }else{ printf("%d\n",(int)pian(x,1,1,n)); } } return 0; }