import std.stdio, std.string, std.algorithm, std.array, std.range, std.conv,
    std.typecons, std.math, std.container, std.format, std.numeric;

class SegTree
{
private:
    long[] xs;
    long size;
public:
    this(long size)
    {
        long i = 1;
        while (i <= size)
        {
            i *= 2;
        }
        this.size = size;
        this.xs = new long[](i * 2);
    }

    void add(long i, long x)
    {
        i += this.size;
        xs[i] += x;
        while (true)
        {
            i /= 2;
            if (i == 0)
            {
                break;
            }
            xs[i] = xs[i * 2] + xs[i * 2 + 1];
        }
    }

    long getSum(long l, long r)
    {
        l += this.size;
        r += this.size;

        long ans = 0;
        while (l < r)
        {
            if (l % 2 == 1)
            {
                ans += xs[l];
                l++;
            }
            l /= 2;
            if (r % 2 == 1)
            {
                ans += xs[r - 1];
                r--;
            }
            r /= 2;
        }
        return ans;
    }
}

void main(string[] args)
{
    long n, q, com, x, y;
    readf("%d %d\n", &n, &q);

    auto seg = new SegTree(n);
    foreach (_; 0 .. q)
    {
        readf("%d %d %d\n", &com, &x, &y);
        if (com == 0)
        {
            seg.add(x, y);
        }
        if (com == 1)
        {
            writeln(seg.getSum(x, y + 1));
        }
    }

}

