Sereja has got an array, consisting of *n* integers, *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>. Sereja is an active boy, so he is now going to complete *m* operations. Each operation will have one of the three forms:
 1.  Make *v*<sub class="lower-index">*i*</sub>-th array element equal to *x*<sub class="lower-index">*i*</sub>. In other words, perform the assignment *a*<sub class="lower-index">*v*<sub class="lower-index">*i*</sub></sub> = *x*<sub class="lower-index">*i*</sub>. 1.  Increase each array element by *y*<sub class="lower-index">*i*</sub>. In other words, perform *n* assignments *a*<sub class="lower-index">*i*</sub> = *a*<sub class="lower-index">*i*</sub> + *y*<sub class="lower-index">*i*</sub> (1 ≤ *i* ≤ *n*). 1.  Take a piece of paper and write out the *q*<sub class="lower-index">*i*</sub>-th array element. That is, the element *a*<sub class="lower-index">*q*<sub class="lower-index">*i*</sub></sub>. 
Help Sereja, complete all his operations.
The first line contains integers *n*, *m* (1 ≤ *n*, *m* ≤ 10<sup class="upper-index">5</sup>). The second line contains *n* space-separated integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>) — the original array.

Next *m* lines describe operations, the *i*-th line describes the *i*-th operation. The first number in the *i*-th line is integer *t*<sub class="lower-index">*i*</sub> (1 ≤ *t*<sub class="lower-index">*i*</sub> ≤ 3) that represents the operation type. If *t*<sub class="lower-index">*i*</sub> = 1, then it is followed by two integers *v*<sub class="lower-index">*i*</sub> and *x*<sub class="lower-index">*i*</sub>, (1 ≤ *v*<sub class="lower-index">*i*</sub> ≤ *n*, 1 ≤ *x*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>). If *t*<sub class="lower-index">*i*</sub> = 2, then it is followed by integer *y*<sub class="lower-index">*i*</sub> (1 ≤ *y*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">4</sup>). And if *t*<sub class="lower-index">*i*</sub> = 3, then it is followed by integer *q*<sub class="lower-index">*i*</sub> (1 ≤ *q*<sub class="lower-index">*i*</sub> ≤ *n*).
'''

* Author : Ayushman Chahar #
* About  : IT Junior       #
* Insti  : VIT, Vellore    #

'''

import os
import sys
# from collections import *
# from itertools import *
# from math import *
# from queue import *
# from heapq import *
# from bisect import *
from io import BytesIO, IOBase

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
readint = lambda: int(sys.stdin.readline().rstrip("\r\n"))
readints = lambda: map(int, sys.stdin.readline().rstrip("\r\n").split())
readstr = lambda: sys.stdin.readline().rstrip("\r\n")
readstrs = lambda: map(str, sys.stdin.readline().rstrip("\r\n").split())
readarri = lambda: [int(_) for _ in sys.stdin.readline().rstrip("\r\n").split()]
readarrs = lambda: [str(_) for _ in sys.stdin.readline().rstrip("\r\n").split()]


def getSum(BITree: list, index: int) -> int:
    summ = 0
    index = index + 1
    while index > 0:
        summ += BITree[index]
        index -= index & (-index)
    return summ


def updateBit(BITTree: list, n: int, index: int, val: int) -> None:
    index = index + 1
    while index <= n:
        BITTree[index] += val
        index += index & (-index)


def summation(x: int, BITTree1: list, BITTree2: list) -> int:
    return (getSum(BITTree1, x) * x) - getSum(BITTree2, x)


def updateRange(BITTree1: list, BITTree2: list, n: int, val: int, l: int, r: int) -> None:
    updateBit(BITTree1, n, l, val)
    updateBit(BITTree1, n, r + 1, -val)
    updateBit(BITTree2, n, l, val * (l - 1))
    updateBit(BITTree2, n, r + 1, -val * r)


def rangeSum(l: int, r: int, BITTree1: list, BITTree2: list) -> int:
    return summation(r, BITTree1, BITTree2) - summation(l - 1, BITTree1, BITTree2)


def solve():
    n, q = readints()
    arr = readarri()
    f1, f2 = [0] * (n + 1), [0] * (n + 1)
    for i in range(n):
        updateRange(f1, f2, n, arr[i], i, i)
    for _ in range(q):
        a = readarri()
        if (a[0] == 1):
            curr = rangeSum(a[1] - 1, a[1] - 1, f1, f2)
            updateRange(f1, f2, n, -curr, a[1] - 1, a[1] - 1)
            updateRange(f1, f2, n, a[2], a[1] - 1, a[1] - 1)
        elif (a[0] == 2):
            updateRange(f1, f2, n, a[1], 0, n - 1)
        else:
            print(rangeSum(a[1] - 1, a[1] - 1, f1, f2))


def main():
    t = 1
    # t = readint()
    for _ in range(t):
        # print("Case #" + str(_ + 1) + ": ", end="")
        solve()


if __name__ == "__main__":
    main()
