#include using namespace std; #define ge getchar() #define Re read*) #define reg register #define rep(i, l, r) for(int i = l; i <= r; ++i) #define lep(i, l, r) for(int i = l; i < r; ++i) #define irep(i, r, l) for(int i = r; i >= l; --i) #define ilep(i, r, l) for(int i = r; i > l; --i) typedef long long ll; inline int read() { int t = 0, x = 0, ch; while(!isdigit(ch = ge)) t |= ch == '-'; while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = ge; return t ? -x : x; } const int MAX_N = 2000007; const int MOD = 998244353; int N, M, Q; int tp[MAX_N]; int val[MAX_N]; char s[MAX_N]; inline int add (int x, int y) { x += y; return x >= MOD ? x - MOD : x; } inline int mul (int x, int y) { return 1LL * x * y % MOD; } inline void update (int x) { if (!tp[x]) val[x] = add(val[x << 1], val[x << 1 | 1]); else val[x] = mul(val[x << 1], val[x << 1 | 1]); } void build (int x, int l, int r) { if (l == r) return val[x] = l, void(); int mid = l + r >> 1; build(x << 1, l, mid); build(x << 1 | 1, mid + 1, r); update(x); } int main () { M = read(), Q = read(); N = (1 << M - 1) - 1; scanf("%s", s + 1); rep (i, 1, N) tp[i] = s[i] - '0'; build(1, 1, N + 1); int op, a, b; while (Q--) { op = read(), a = read(); if (op == 1) { b = read(); a += N; val[a] = b; a >>= 1; while (a) update(a), a >>= 1; } else { a += N; int res = 1, now = (a & 1); a >>= 1; while (a) { if (tp[a]) { res = mul(res, now ? val[a << 1] : val[a << 1 | 1]); } now = (a & 1); a >>= 1; } printf("%d\n", res); } } return 0; }