#include #include #include #include #include namespace IO { template inline bool read (_T& x) { x = 0; _T y = 1; char c = getchar(); while ((c < '0' || '9' < c) && c != EOF) { if (c == '-') y = -1; c = getchar(); } if (c == EOF) return false; while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getchar(); x *= y; return true; } template inline _T input () { _T x = 0, y = 1; char c = getchar(); while ((c < '0' || '9' < c) && c != EOF) { if (c == '-') y = -1; c = getchar(); } if (c == EOF) return 0; while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getchar(); x *= y; return x; } }; using namespace IO; #define reg register #define MAX_N 2000007 #define MOD 998244353 #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; 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 () { #ifndef ONLINE_JUDGE // freopen ("in", "r", stdin); #endif read(M), read(Q); N = (1 << M - 1) - 1; scanf("%s", s + 1); rep (i, 1, N) tp[i] = s[i] - '0'; build(1, 1, N + 1); // rep (i, 1 + N, N * 2 + 1) printf("%d ", val[i]); puts(""); int op, a, b; while (Q--) { read(op), read(a); if (op == 1) { read(b); a += N; val[a] = b; a >>= 1; while (a) update(a), a >>= 1; } else { a += N; int res = 1, now = (a & 1); a >>= 1; // printf("%d\n", a); while (a) { if (tp[a]) { // printf("%d %d %d\n", a, now, now ? val[a << 1] : val[a << 1 | 1]); res = mul(res, now ? val[a << 1] : val[a << 1 | 1]); } now = (a & 1); a >>= 1; } printf("%d\n", res); } } return 0; }