// Arup Guha
// 4/18/2023
// Solution to BIT Practice Problem: Corgi Houses

using namespace std;
#include <bits/stdc++.h>
typedef long long ll;

class bit {
    public:
        bit(int n);
        ll sum(int idx);
        ll sum(int low, int high);
        void add(int idx, ll val);
    private:
        int sz;
        vector<ll> freq;
};

bit::bit(int n) {
    sz = 1;
    while (sz <= n) sz <<= 1;
    for (int i=0; i<sz; i++) freq.push_back(0);
}

ll bit::sum(int idx) {
    ll res = 0;
    while (idx) {
        res += freq[idx];
        idx -= (idx&(-idx));
    }
    return res;
}

ll bit::sum(int low, int high) {
    return sum(high) - sum(low-1);
}

void bit::add(int idx, ll val) {
    while (idx < sz) {
        freq[idx] += val;
        idx += (idx&(-idx));
    }
}

int main() {

    int n, d, tmp;
    cin >> n >> d;
    bit mybit(n+1);

    // Go through each action/query.
    for (int i=0; i<d; i++) {

        int type;
        cin >> type;

        // Add or Subtract Corgis.
        if (type == 1) {
            int idx;
            ll delta;
            cin >> idx >> delta;
            mybit.add(idx, delta);
        }

        // Query.
        else {
            int low, high;
            cin >> low >> high;
            cout << mybit.sum(low, high) << endl;
        }
    }

    return 0;
}
