#include <iostream>
#include <vector>

using std::cin;
using std::cout;
using std::vector;

class BIT {
  vector<int> tree;

 public:
  BIT(int n) : tree(n, 0) {}
  void add(int i, int x) {
    while (i <= tree.size()) {
      tree[i] += x;
      i += i & -i;
    }
  }

  int sum(int s) {
    int ans = 0;
    while (s > 0) {
      ans += tree[s];
      s -= s & -s;
    }

    return ans;
  }
};

int main(int argc, const char *argv[]) {
  int n, q;
  cin >> n >> q;
  BIT bit(n + 1);
  for (int i = 0; i < q; i++) {
    int c, x, y;
    cin >> c >> x >> y;
    if (c == 0) {
      bit.add(x, y);
    } else {
      cout << bit.sum(y) - bit.sum(x - 1) << '\n';
    }
  }

  return 0;
}
