from copy import *

import sys

S=sys.stdin.readlines()



def init(N,node,unit,func):

  n=1

  while n<N:

    n<<=1

  for i in range(n*2-1):

    if len(node)<=i:

      node.append(deepcopy(unit))

    else:

      node[i]=deepcopy(unit)

  node.append(func)

  node.append(unit)

  node.append(n)



def upd(node,x,a):

  y=node[-1]+x

  node[y-1]=a

  while y>1:

    y=y>>1

    node[y-1]=node[-3](node[(y<<1)-1],node[y<<1])



def query(node,l,r):

  x,y=l,r

  z=node[-1]-1

  r=node[-2]

  while True:

    if x==y:

      return r

    if x&1:

      r=node[-3](r,node[x+z])

      x+=1

    if y&1:

      r=node[-3](r,node[y+z-1])

    x>>=1

    y>>=1

    z>>=1

    if z==0:

      return r



def bis_min_k(node,k,cond):

  x=k+1

  while True:

    if node[-1]<=x:

      return x-node[-1]

    if cond(node[(x<<1)-1]):

      x=x<<1

    else:

      x=(x<<1)+1



def bis_min(node,l,r,cond):

  x,y=l,r

  z=node[-1]-1

  for i in range(30):

    if x+(1<<i)>y:

      break

    if x&(1<<i):

      if cond(node[z+(x>>i)]):

        return bis_min_k(node,z+(x>>i),cond)

      x+=(1<<i)

    if z==0:

      break

    z>>=1

  for i in range(29,-1,-1):

    if i and ((node[-1]-1)>>(i-1))==0:

      continue

    if x+(1<<i)>y:

      continue

    if (y-x)&(1<<i):

      if cond(node[((node[-1]-1)>>i)+(x>>i)]):

        return bis_min_k(node,((node[-1]-1)>>i)+(x>>i),cond)

      x+=(1<<i)

  return node[-1]



N,Q=list(map(int,S[0].split()))

A=list(map(int,S[1].split()))

X=[]

init(N+1,X,0,lambda x,y:x+y)

for i in range(N):

  upd(X,i,A[i])

a,b,c=0,0,0

for i in range(Q):

  a,b,c=list(map(int,S[i+2].split()))

  if a:

    print((query(X,b,c)))

  else:

    upd(X,b,X[X[-1]+b-1]+c)
import sys

S=sys.stdin.readlines()

def Binit(B,siz):

  while len(B)<siz+1:

    B.append(0)

  while len(B)>siz+1:

    del B[-1]

  for i in range(siz+1):

    B[i]=0

  B.append(siz)



def Badd(B,a,x):

  z=a

  while z<=B[-1]:

    B[z]+=x

    z+=(z&(-z))



def Bsum(B,a):

  r=0

  z=a

  while z>0:

    r+=B[z]

    z-=(z&(-z))

  return r



def Bssum(B,a,b):

  return Bsum(B,max(a,b))-Bsum(B,min(a,b)-1)



BIT=[]

N,Q=list(map(int,S[0].split()))

Binit(BIT,N+1)

A=list(map(int,S[1].split()))

for i in range(N):

  Badd(BIT,i+1,A[i])

a,b,c=0,0,0

for i in range(Q):

  a,b,c=list(map(int,S[i+2].split()))

  if a:

    print((Bssum(BIT,b+1,c)))

  else:

    Badd(BIT,b+1,c)
from copy import *
import sys

S = sys.stdin.readlines()


def init(N, node, unit, func):
    n = 1
    while n < N:
        n <<= 1
    for i in range(n * 2 - 1):
        if len(node) <= i:
            node.append(deepcopy(unit))
        else:
            node[i] = deepcopy(unit)
    node.append(func)
    node.append(unit)
    node.append(n)


def upd(node, x, a):
    y = node[-1] + x
    node[y - 1] = a
    while y > 1:
        y = y >> 1
        node[y - 1] = node[-3](node[(y << 1) - 1], node[y << 1])


def query(node, l, r):
    x, y = l, r
    z = node[-1] - 1
    r = node[-2]
    while True:
        if x == y:
            return r
        if x & 1:
            r = node[-3](r, node[x + z])
            x += 1
        if y & 1:
            r = node[-3](r, node[y + z - 1])
        x >>= 1
        y >>= 1
        z >>= 1
        if z == 0:
            return r


def bis_min_k(node, k, cond):
    x = k + 1
    while True:
        if node[-1] <= x:
            return x - node[-1]
        if cond(node[(x << 1) - 1]):
            x = x << 1
        else:
            x = (x << 1) + 1


def bis_min(node, l, r, cond):
    x, y = l, r
    z = node[-1] - 1
    for i in range(30):
        if x + (1 << i) > y:
            break
        if x & (1 << i):
            if cond(node[z + (x >> i)]):
                return bis_min_k(node, z + (x >> i), cond)
            x += 1 << i
        if z == 0:
            break
        z >>= 1
    for i in range(29, -1, -1):
        if i and ((node[-1] - 1) >> (i - 1)) == 0:
            continue
        if x + (1 << i) > y:
            continue
        if (y - x) & (1 << i):
            if cond(node[((node[-1] - 1) >> i) + (x >> i)]):
                return bis_min_k(node, ((node[-1] - 1) >> i) + (x >> i), cond)
            x += 1 << i
    return node[-1]


N, Q = list(map(int, S[0].split()))
A = list(map(int, S[1].split()))
X = []
init(N + 1, X, 0, lambda x, y: x + y)
for i in range(N):
    upd(X, i, A[i])
a, b, c = 0, 0, 0
for i in range(Q):
    a, b, c = list(map(int, S[i + 2].split()))
    if a:
        print((query(X, b, c)))
    else:
        upd(X, b, X[X[-1] + b - 1] + c)

import sys

S = sys.stdin.readlines()


def Binit(B, siz):
    while len(B) < siz + 1:
        B.append(0)
    while len(B) > siz + 1:
        del B[-1]
    for i in range(siz + 1):
        B[i] = 0
    B.append(siz)


def Badd(B, a, x):
    z = a
    while z <= B[-1]:
        B[z] += x
        z += z & (-z)


def Bsum(B, a):
    r = 0
    z = a
    while z > 0:
        r += B[z]
        z -= z & (-z)
    return r


def Bssum(B, a, b):
    return Bsum(B, max(a, b)) - Bsum(B, min(a, b) - 1)


BIT = []
N, Q = list(map(int, S[0].split()))
Binit(BIT, N + 1)
A = list(map(int, S[1].split()))
for i in range(N):
    Badd(BIT, i + 1, A[i])
a, b, c = 0, 0, 0
for i in range(Q):
    a, b, c = list(map(int, S[i + 2].split()))
    if a:
        print((Bssum(BIT, b + 1, c)))
    else:
        Badd(BIT, b + 1, c)

-from copy import * -def init(N, node, unit, func): -    n = 1 -    while n < N: -        n <<= 1 -    for i in range(n * 2 - 1): -        if len(node) <= i: -            node.append(deepcopy(unit)) -        else: -            node[i] = deepcopy(unit) -    node.append(func) -    node.append(unit) -    node.append(n) +def Binit(B, siz): +    while len(B) < siz + 1: +        B.append(0) +    while len(B) > siz + 1: +        del B[-1] +    for i in range(siz + 1): +        B[i] = 0 +    B.append(siz) -def upd(node, x, a): -    y = node[-1] + x -    node[y - 1] = a -    while y > 1: -        y = y >> 1 -        node[y - 1] = node[-3](node[(y << 1) - 1], node[y << 1]) +def Badd(B, a, x): +    z = a +    while z <= B[-1]: +        B[z] += x +        z += z & (-z) -def query(node, l, r): -    x, y = l, r -    z = node[-1] - 1 -    r = node[-2] -    while True: -        if x == y: -            return r -        if x & 1: -            r = node[-3](r, node[x + z]) -            x += 1 -        if y & 1: -            r = node[-3](r, node[y + z - 1]) -        x >>= 1 -        y >>= 1 -        z >>= 1 -        if z == 0: -            return r +def Bsum(B, a): +    r = 0 +    z = a +    while z > 0: +        r += B[z] +        z -= z & (-z) +    return r -def bis_min_k(node, k, cond): -    x = k + 1 -    while True: -        if node[-1] <= x: -            return x - node[-1] -        if cond(node[(x << 1) - 1]): -            x = x << 1 -        else: -            x = (x << 1) + 1 +def Bssum(B, a, b): +    return Bsum(B, max(a, b)) - Bsum(B, min(a, b) - 1) -def bis_min(node, l, r, cond): -    x, y = l, r -    z = node[-1] - 1 -    for i in range(30): -        if x + (1 << i) > y: -            break -        if x & (1 << i): -            if cond(node[z + (x >> i)]): -                return bis_min_k(node, z + (x >> i), cond) -            x += 1 << i -        if z == 0: -            break -        z >>= 1 -    for i in range(29, -1, -1): -        if i and ((node[-1] - 1) >> (i - 1)) == 0: -            continue -        if x + (1 << i) > y: -            continue -        if (y - x) & (1 << i): -            if cond(node[((node[-1] - 1) >> i) + (x >> i)]): -                return bis_min_k(node, ((node[-1] - 1) >> i) + (x >> i), cond) -            x += 1 << i -    return node[-1] - - +BIT = [] +Binit(BIT, N + 1) -X = [] -init(N + 1, X, 0, lambda x, y: x + y) -    upd(X, i, A[i]) +    Badd(BIT, i + 1, A[i]) -        print((query(X, b, c))) +        print((Bssum(BIT, b + 1, c))) -        upd(X, b, X[X[-1] + b - 1] + c) +        Badd(BIT, b + 1, c)