#include "bits/stdc++.h"

using namespace std;
#define int long long
vector<int> tr, lz, a;
#define ls (now<<1)
#define rs (now<<1|1)
#define mid (l+r>>1)

void pushup(int now) { tr[now] = tr[ls] + tr[rs]; }

void pushdown(int now, int l, int r) {
    tr[ls] += lz[now] * (mid - l + 1), tr[rs] += lz[now] * (r - mid);
    lz[ls] += lz[now], lz[rs] += lz[now];
    lz[now] = 0;
}

void build(int now, int l, int r) {//建树
    if (l == r) {
        tr[now] = a[l];
        return;
    }
    build(ls, l, mid), build(rs, mid + 1, r);
    pushup(now);
}

void modify(int now, int l, int r, int ml, int mr, int k) {//修改
    if (l == ml && r == mr) {
        tr[now] += (r - l + 1) * k, lz[now] += k;
        return;
    }
    pushdown(now, l, r);
    if (mr <= mid) modify(ls, l, mid, ml, mr, k);
    else if (ml > mid) modify(rs, mid + 1, r, ml, mr, k);
    else modify(ls, l, mid, ml, mid, k), modify(rs, mid + 1, r, mid + 1, mr, k);
    pushup(now);
}

int query(int now, int l, int r, int ml, int mr) {//查询
    if (l == ml && r == mr) return tr[now];
    pushdown(now, l, r);
    if (mr <= mid) return query(ls, l, mid, ml, mr);
    else if (ml > mid) return query(rs, mid + 1, r, ml, mr);
    else return query(ls, l, mid, ml, mid) + query(rs, mid + 1, r, mid + 1, mr);
}

void slu() {
    int n;//原本数组长度
    int m;//修改+查询次数
    cin >> n >> m;
    a.resize(n + 1);
    tr.resize((n << 2) + 1);
    lz.resize((n << 2) + 1);
    for (int i = 1; i <= n; i++)cin >> a[i];
    build(1, 1, n);//建树-->tr为树状数组
    for (int i = 0; i < m; i++) {
        int ask;
        cin >> ask;
        if (ask == 1) {//修改
            int loc, k;
            cin >> loc >> k;
            modify(1, 1, n, loc, loc, k);
        } else {//输出区间和
            int l, r;
            cin >> l >> r;
            cout << query(1, 1, n, l, r) << endl;
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int T;
//    cin >> T;
    T = 1;
    while (T--)slu();

}