#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
#define int long long

class SqrtDecomposition{
private:
    int n; //元の配列のサイズ
    int sz; //1つのバケットが担当する区間の長さ
    int num; //バケットの個数
    vector<int> v,bucket;
    int init;

    int combine(int a, int b){
        //return min(a,b);
        //return max(a,b);
        return a+b;
    }

    int idx(int i){
        return i/sz;
    }
    void build(){
        sz = sqrt(n);
        num = (n + sz-1)/sz;
        bucket = vector<int>(num,init);
        //bucketの更新
        for(int i = 0; i < n; i++){
            bucket[idx(i)] = combine(bucket[idx(i)], v[i]);
        }
    }
    void recalc(int id){
        bucket[id] = init;
        for(int i = id*sz; i < min((id+1)*sz,n); i++){
            bucket[id] = combine(bucket[id], v[i]);
        }
    }
public:
    SqrtDecomposition(){
    }
    SqrtDecomposition(int size, int initial){
        n = size;
        init = initial;
        v = vector<int> (n,init);
        build();
    }
    SqrtDecomposition(vector<int> in, int initial){
        n = in.size();
        init = initial;
        v = in;
        build();
    }
    void update(int ind, int x){
        //v[ind]をxに変更する
        v[ind] = x;
        recalc(idx(ind));
    }
    void add(int ind, int x){
        //v[ind]にxを足す
        v[ind] += x;
        recalc(idx(ind));
    }
    int query_min(int l, int r){
        //[l,r)の最小値を求める
        int ret = init;
        int lid = idx(l);
        int rid = idx(r);
        if(lid == rid){
            for(int i = l; i < r; i++){
                ret = min(ret, v[i]);
            }
            return ret;
        }
        for(int i = l; i < (lid+1)*sz; i++){
            ret = min(ret, v[i]);
        }
        for(int i = lid+1; i < rid; i++){
            ret = min(ret, bucket[i]);
        }
        for(int i = rid*sz; i < r; i++){
            ret = min(ret, v[i]);
        }
        return ret;
    }
    int query_sum(int l, int r){
        //[l,r)の総和を求める
        int ret = init;
        int lid = idx(l);
        int rid = idx(r);
        if(lid == rid){
            for(int i = l; i < r; i++){
                ret += v[i];
            }
            return ret;
        }
        for(int i = l; i < (lid+1)*sz; i++){
            ret += v[i];
        }
        for(int i = lid+1; i < rid; i++){
            ret += bucket[i];
        }
        for(int i = rid*sz; i < r; i++){
            ret += v[i];
        }
        return ret;
    }
    void show(){
        cout << endl;
        cout << "n = " << n;
        cout << ", sz = " << sz;
        cout << ", num = " << num;
        cout << endl;
        cout << "v:";
        for(int i = 0; i < n; i++)cout << " " << v[i];cout << endl;
        cout << "bucket:";
        for(int i = 0; i < num; i++)cout << " " << bucket[i];cout << endl;
        cout << endl;
    }
};


//http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4398822#1
void dsl2a(){
    int n,q;
    cin >> n >> q;
    long init = (1LL<<31)-1;
    vector<int> in(n,init);
    SqrtDecomposition sd(in,init);
    while(q--){
        int com,x,y;
        cin >> com >> x >> y;
        if(com == 0){//a_xをyに変更する
            sd.update(x,y);
        }else{//a_x ~ a_yの最小値を出力する
            //sd.show();
            cout << sd.query_min(x,y+1) << endl;
        }
    }
}
void dsl2b(){
    int n,q;
    cin >> n >> q;
    long init = 0;
    vector<int> in(n,init);
    SqrtDecomposition sd(in,init);
    while(q--){
        int com,x,y;
        cin >> com >> x >> y;
        if(com == 0){//a_xにyを加える
            x--;
            sd.add(x,y);
        }else{//a_x ~ a_yの総和を出力する
            //sd.show();
            x--,y--;
            cout << sd.query_sum(x,y+1) << endl;
        }
    }
}
signed main(){
    dsl2b();
}



Measured memory_bytes: 5228