#include <stdio.h>

#define MAX 100002

int A[MAX];
int B[MAX];

int main(void) {
	int i, j, n, q, m;
	int com, x, y;
	int *p, *b, *a;
	int pos = MAX;
	int last_y = 0;

	scanf("%d %d\n", &n, &q);
	for(i=0;i<=n;i++) {
		A[i] = 0;
		B[i] = 0;
	}
	
	for(i=0;i<q;i++) {
		scanf("%d %d %d\n", &com, &x, &y);
		if(com == 0) {
			A[x] += y;
			if(pos > x)	pos = x;
		} else {
			if(pos != MAX || last_y < y) {
				for(j=pos,a=&A[j],b=&B[j];j<=y;j++,a++,b++) *b = *a + *(b-1);
				pos = MAX;
			}
			printf("%d\n", B[y]-B[x-1]);
			if(last_y < y) last_y = y;
		}
	}
	
	return 0;
}