from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
queries = [tuple(map(int, input().split())) for _ in range(Q)]


fst_x = None
snd_x = defaultdict(lambda: 0)  # type: ignore
for i in range(Q):
    q = queries[i]
    if q[0] == 1:
        _, x = q
        fst_x = x
        snd_x = defaultdict(lambda: 0)
    elif q[0] == 2:
        _, i, x = q
        snd_x[i - 1] += x
    elif q[0] == 3:
        _, i = q
        a = fst_x if fst_x is not None else A[i - 1]
        print(a + snd_x[i - 1])
