import std.stdio, std.string, std.conv, std.range, std.array, std.algorithm;
import std.uni, std.math, std.container, std.typecons, std.typetuple;
import core.bitop, std.datetime;

void main(){
    int n, q, c, x, y;
    readVars(n, q);

    auto a = new int[](n);
    auto ft = new FenwickTree!(int)(a);

    foreach(qi ; 0 .. q){
        readVars(c, x, y);
        x--;

        if(c == 0){
            ft.add(x, y);
        } else {
            writeln(ft.getSum(y) - ft.getSum(x));
        }
    }
}

class FenwickTree(T){
private:
    T[] data;
    int N;

public:
    this(T[] a){
        data = [0] ~ a[];
        N = a.length.to!int;

        foreach (i ; 1 .. N + 1) {
            if (i + (i & (-i)) <= N) {
                data[i + (i & (-i))] += data[i];
            }
        }
    }

    void add(int i, T x) {
        i++;

        while (i <= N) {
            data[i] += x;
            i += i & (-i);
        }
    }

    T getSum(int r) {
        T res;

        while(r > 0){
            res += data[r];
            r -= r & (-r);
        }

        return res;
    }

    void print(){
        stderr.writefln("%(%s %)", data);
    }
}


void readVars(T...)(auto ref T args){
    auto line = readln.split;
    foreach(ref arg ; args){
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    if(!line.empty){
        throw new Exception("args num < input num");
    }
}