from math import log2
from math import ceil
from operator import add
def get_parent_ind_and_is_R(ind):
    return divmod( ind, 2 )
def update_parent_and_get_parent_ind(tree, ind, fun):
    parent_ind, is_R = get_parent_ind_and_is_R(ind)
    if is_R:
        tree[parent_ind] = fun( tree[ind - 1], tree[ind] )
    else:
        tree[parent_ind] = fun( tree[ind], tree[ind + 1] )
    return parent_ind
def update_all_parents(tree, ind, fun):
    while ind > 1:
        ind = update_parent_and_get_parent_ind(tree, ind, fun)
def fill_tree(tree, fun):
    for i in range( len(tree)-1, 2, -2 ):
        update_parent_and_get_parent_ind(tree, i, fun)
def tree_ind_from_arr_ind(tree, ind):
    return len(tree)//2 + ind
def set_leaf_and_update_parents( tree, ind, val, fun ):
    tree_ind = tree_ind_from_arr_ind(tree, ind)
    tree[ tree_ind ] = val
    update_all_parents(tree, tree_ind, fun)
def is_R(ind):
    return ind % 2
def get_fun_for_segm( tree, L, R, fun, empty_val_for_fun ):
    res = empty_val_for_fun
    L   = tree_ind_from_arr_ind(tree, L)
    R   = tree_ind_from_arr_ind(tree, R)
    while L <= R:
        if is_R(L):
            res = fun(res, tree[L])
        if not is_R(R):
            res = fun(res, tree[R])
        L = L+1 >> 1
        R = R-1 >> 1
    return res
def exec_ops( tree, ops, fun, empty_val_for_fun ):
    for op in ops:
        a, b, c = op
        if a == 1:
            ind = b
            val = c
            set_leaf_and_update_parents(tree, ind, val, fun)
        else:
            L_arr_ind = b
            segm_len  = c
            print( get_fun_for_segm( tree, L_arr_ind, segm_len-1, fun, empty_val_for_fun ) )
n, m = map( int, input( 'n, m = ' ).split() )
lis  = list( map( int, input( 'array = ' ).split() ) )
n_2  = 1 << ceil( log2(n) )
empty_val_for_add = 0
tree = [0]*n_2 + lis + [ empty_val_for_add ]*(n_2 - n)
fill_tree( tree, add )
ops  = []
for _ in range(m):
    ops.append( tuple( map( int, input( 'a,b,c = ' ).split() ) ) )
exec_ops( tree, ops, add, empty_val_for_add )

