#include <bits/stdc++.h>
#include <boost/format.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#define rep(i, n) repr((i), 0, (n))
#define repr(i, a, t) reps((i), (a), (t), 1)
#define reps(i, a, t, s) for (long long (i) = (a); (i) < (long long)(t); (i) += (s))
#define rrep(i, n) rrepr((i), (n) - 1, 0)
#define rrepr(i, a, t) rreps((i), (a), (t), 1)
#define rreps(i, a, t, s) for (long long (i) = (a); (i) >= (long long)(t); (i) -= (s))
#define each(v, c) for (auto &&(v) : (c))
#define all(c) (c).begin(), (c).end()
using namespace std;
namespace mp = boost::multiprecision;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using ml = mp::cpp_int;
template<typename T>
using optional = boost::optional<T>;
const auto none = boost::none;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  if (v.empty()) return os << "vector{}";
  os << "vector{" << *v.begin();
  for (auto it = ++v.begin(); it != v.end(); ++it)
    os << ", " << *it;
  return os << "}";
}
template<typename T>
ostream &operator<<(ostream &os, const set<T> &s) {
  if (s.empty()) return os << "set{}";
  os << "set{" << *s.begin();
  for (auto it = ++s.begin(); it != s.end(); ++it)
    os << ", " << *it;
  return os << "}";
}
template<typename S, typename T>
ostream &operator<<(ostream &os, const map<S, T> &m) {
  if (m.empty()) return os << "map{}";
  os << "map{" << (*m.begin()).first << ": " << (*m.begin()).second;
  for (auto it = ++m.begin(); it != m.end(); ++it)
    os << ", " << (*it).first << ": " << (*it).second;
  return os << "}";
}
template<typename S, typename T>
ostream &operator<<(ostream &os, const pair<S, T> &p) {
  return os << "pair{" << p.first << ", " << p.second << "}";
}

/**
 * http://tsutaj.hatenablog.com/entry/2017/03/29/204841
 */
class SegmentTree {
 private:
  vector<ll> nodes;
  ull size;
  function<ll(ll, ll)> fn;

 public:
  SegmentTree(ull size, function<ll(ll, ll)> fn = [](ll a, ll b) { return a + b; }) {
    // size 以上の最小の2べき
    ll sz = 1;
    while (sz <= size) sz <<= 1;
    this->size = sz;

    this->nodes = vector<ll>(this->size * 2, 0);
    this->fn = fn;
  }

  optional<ll> get(ull from_i, ull to_i, ull k = 1, ll l = 0, ll r = -1) {
    if (r < 0) r = size;

    // 被覆してる
    if (from_i <= l && r <= to_i) return nodes[k];
    // 関係ない
    if (r <= from_i || to_i <= l) return none;

    // 子からもらう
    optional<ll> left = get(from_i, to_i, k * 2, l, (l + r) / 2);
    optional<ll> right = get(from_i, to_i, k * 2 + 1, (l + r) / 2, r);

    if (left && right) return (*left) + (*right);
    if (left) return *left;
    if (right) return *right;
    return none;
  }

  void add(ull i, ll value) {
    ll k = size + i;

    nodes[k] = fn(nodes[k], value);
    k /= 2;
    while (k > 0) {
      nodes[k] = fn(nodes[k * 2], nodes[k * 2 + 1]);
      k /= 2;
    }
  }
};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ifstream ifs;
  if (getenv("LOCAL") != nullptr) {
    ifs.open("src/_in.txt");
    cin.rdbuf(ifs.rdbuf());
  }

  ll N, Q;
  cin >> N >> Q;

  SegmentTree st = SegmentTree(N + 1);
  rep (i, Q) {
    ll com, x, y;
    cin >> com >> x >> y;
    if (com == 0) {
      st.add(x, y);
    } else {
      const auto val = st.get(x, y + 1);
      cout << *val << endl;
    }
  }
}



Measured memory_bytes: 4936