def change(index, value): diff = value - dp[0][index] for i in range(1 + N // 2): for j in range(2 ** i): dp[i][j ^ index] += diff * p11[2 ** i - j - 1] * p2[j] dp[i][j ^ index] %= mod def calc(L, R, X): if L == R: return 0 temp = 1 key = 0 while L % temp == 0 and R - L >= temp and key < N // 2 + 1: temp *= 2 key += 1 temp //= 2 return (dp[key - 1][X ^ L] * p11[R - L - temp] + calc(L + temp, R, X) * p2[temp]) % mod N = int(input()) S = list(map(int, list(input()))) Q = int(input()) mod = 998244353 dp = [[0 for i in range(2 ** N)] for j in range(1 + N // 2)] query = [[1, i, S[i]] for i in range(2 ** N)] + [list(map(int, input().split())) for i in range(Q)] p2 = [1 for i in range(2 ** N)] p11 = [1 for i in range(2 ** N)] for i in range(1, 2 ** N): p2[i] = p2[i - 1] * 2 % mod p11[i] = p11[i - 1] * 11 % mod for q in query: if q[0] == 1: change(*q[1:]) else: print(calc(q[1], q[2] + 1, q[3]))