#include <bits/stdc++.h>

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef int64_t Int;
typedef std::vector<Int> LI;
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

template<typename T>
struct Maybe {
   T x;
   bool valid;
   Maybe() : valid(false) {}
   Maybe(T x_) : x(x_), valid(true) {}
   operator T() const {
      assert( valid );
      return x;
   }
};

template<typename T>
struct Solver2 {
   Int n;
   T e;
   std::function<T(T,T)> f;
   std::vector<Int> ls, rs;
   std::vector<T> xs;
   Solver2(Int n_, T e_, std::function<T(T,T)> f_)
      : n(round2(n_)), e(e_), f(f_), ls(2*n), rs(2*n), xs(2*n, e) {
      for(Int i = n; i < 2 * n; ++i) {
         ls[i] = i-n;
         rs[i] = i-n+1;
      }
      for(Int i = n - 1; i >= 1; --i) {
         ls[i] = ls[2*i];
         rs[i] = rs[2*i+1];
      }
   }
   Int round2(Int x) {
      Int res = 1;
      while( not ( res >= x ) ) res *= 2;
      return res;
   }
   void update(Int k) {
      if( k == 0 ) return;
      if( k < n ) xs[k] = f(xs[2*k], xs[2*k+1]);
      update(k/2);
   }
   void update(Int i, T x) {
      xs[i+n] = x;
      update(i+n);
   }
   void update(Int i, std::function<T(T)> g) {
      xs[i+n] = g(xs[i+n]);
      update(i+n);
   }
   T query(Int left, Int right, Int k = 1) {
      if( right <= ls[k] or rs[k] <= left ) return e;
      if( n <= k ) return xs[k];
      if( left <= ls[k] and rs[k] <= right ) return xs[k];
      return f(query(left, right, 2*k), query(left, right, 2*k+1));
   }
};

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      Int n, q; scan(n, q);
      Solver2<Int> rmq(n, 0, [](Int x, Int y){return x+y;});
      for(Int i = 0; i < q; ++i) {
         Int a, b, c; scan(a, b, c);
         if( a == 0 ) {
            b -= 1;
            rmq.update(b, [c](Int x){return x+c;});
         }
         if( a == 1 ) {
            b -= 1, c -= 1;
            printf("%ld\n", rmq.query(b, c+1));
         }
      }
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}

Measured memory_bytes: 8864