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

int readint() {
    return readln.chomp.to!int;
}

int[] readints() {
    return readln.split.map!(to!int).array;
}

void main() {
    auto nq = readints();
    int n = nq[0], q = nq[1];

    auto bit = new BinaryIndexTree(n);
    for (int i = 0; i < q; i++) {
        auto xs = readints();
        switch (xs[0]) {
        case 0: // add
            bit.add(xs[1], xs[2]);
            break;
        case 1: // sum
            int sum = bit.sum(xs[2]) - bit.sum(xs[1] - 1);
            writeln(sum);
            break;
        default:
            break;
        }
    }
}

class BinaryIndexTree {
    private int[] _bit;

    this(int n) {
        _bit = new int[n + 1];
    }

    int sum(int p) {
        int s = 0;
        while (p > 0) {
            s += _bit[p];
            p -= p & -p;
        }
        return s;
    }

    void add(int p, int x) {
        while (p < _bit.length) {
            _bit[p] += x;
            p += p & -p;
        }
    }
}