import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.math;


void main() {
    int n, q;
    scan(n, q);

    auto sd = SqrtDecomp(n);

    foreach (_ ; 0 .. q) {
        auto line = readln.split.to!(int[]);
        if (line[0] == 0) {
            sd.add(line[1] - 1, line[2]);
        }
        else {
            writeln(sd.sum(line[1] - 1, line[2]));
        }
    }
}

struct SqrtDecomp {
    private {
        int N, K;
        enum sqrtN = 512;
        int[] bucketSum;
        int[] data;
    }

    this(int n) {
        N = n;
        K = (N + sqrtN - 1) / sqrtN;
        bucketSum = new int[](K);
        data = new int[](K * sqrtN);
    }

    void add(int i, int x) {
        int k = i / sqrtN;
        data[i] += x;
        bucketSum[k] += x;
    }

    int sum(int l, int r) {
        int res;
        foreach (k ; 0 .. K) {
            int bl = k * sqrtN, br = (k + 1) * sqrtN;
            if (r <= bl || br <= l) continue;
            if (l <= bl && br <= r) {
                res += bucketSum[k];
            }
            else {
                foreach (i ; max(l, bl) .. min(r, br)) {
                    res += data[i];
                }
            }
        }
        return res;
    }
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

