#include <bits/stdc++.h>
using namespace std;

class BIT {
		vector<int> dat;
		int const N;
	public:
		BIT(int N) : N(N), dat(N+1, 0) {}
		void add(int k, int a) {
			while (k <= N) {
				dat[k] += a;
				k += k & -k;
			}
		}
		int sum(int k) {
			int res = 0;
			while (k >= 1) {
				res += dat[k];
				k -= k & -k;
			}
			return res;
		}
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, q;
	cin >> n >> q;
	BIT rsq(n);
	for (auto i = 0; i < q; i++) {
		int c, x, y;
		cin >> c >> x >> y;
		if (c) cout << rsq.sum(y)-rsq.sum(x-1) << endl;
		else rsq.add(x, y);
	}
	return 0;
}