class Fenwick: def __init__(self, n): self.n = n self.data = [0] * (n + 1) self.depth = n.bit_length() def getsum(self, i): # 0-indexed [0: i) res = 0 while i > 0: res += self.data[i] i -= i & -i return res def add(self, i, x): # 0-indexed i += 1 while i <= self.n: self.data[i] += x i += i & -i import sys input = sys.stdin.readline N, Q = map(int, input().split()) A = list(map(int, input().split())) BITA = Fenwick(N) for i in range(N): BITA.add(i, A[i]) BITlr = Fenwick(N) for i in range(Q): T, l, r = map(int, input().split()) l -= 1 r -= 1 if T == 1: BITlr.add(l, r - l) else: l += BITlr.getsum(l) r += BITlr.getsum(r) print(BITA.getsum(r + 1) - BITA.getsum(l))