#include<stdio.h>
#define NMAX 100000
int bit[NMAX+1];
int input(void);
void add(int i, int x, int n);
int sum(int i);
int main(void)
{
  int command, i, n, q, s, t;
  n = input();
  q = input();
  for (i = 0; i < q; i++) {
    command = input();
    if (!command) {
      s = input();
      t = input();
      add(s, t, n);
    } else {
      s = input();
      t = input();
      printf("%d\n", sum(t) - sum(s - 1));
    }
  }
}

int input(void)
{
  int n = 0, c = getchar_unlocked();
  if (c == '-') {
    c = getchar_unlocked();
    do {
      n = 10 * n + c - '0';
      c = getchar_unlocked();
    } while (c >= '0' && c <= '9');
    return -n;
  } else {
    do {
      n = 10 * n + c - '0';
      c = getchar_unlocked();
    } while (c >= '0' && c <= '9');
    return n;
  }
}

void add(int i, int x, int n)
{
  while (i <= n) {
    bit[i] += x;
    i += i & (-i);
  }
}

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