#include <bits/stdc++.h>

using namespace std;

template<typename T>
struct BIT
{
  static const int MAX_N = 1 << 17;
  T bit[MAX_N + 1] = {};
  int n;

  void init(int n_)
  {
    n = n_;
  }

  BIT(int n_)
  {
    n = n_;
  }

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

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

int n, a[100000];

void solve()
{
  int n, q;
  cin >> n >> q;
  BIT<int> bit(n);
  while(q--) {
    int com, x, y;
    cin >> com >> x >> y;
    if(com) {
      cout << bit.sum(y) - bit.sum(x - 1) << "\n";
    } else {
      bit.add(x, y);
    }
  }
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
}