#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

//ここから編集
struct HLD{

  int n; /* 木の頂点数 */
  vector<vector<int>> g;
  vector<int> subtr, vid, head, par;

  HLD() {}
  HLD(int _sz): n(_sz), g(n), vid(n,-1), head(n), subtr(n,1), par(n){}
  HLD(vector<vector<int>> G) : n(G.size()), g(G), vid(n,-1), head(n), subtr(n, 1), par(n){}


  void add_edge(int u, int v){
    g[u].push_back(v);
    g[v].push_back(u);
  }

  void build(vector<int> rs = vector<int>(1,0)){
    int k = 0;
    for(int r: rs){
      dfs_sz(r, -1);
      head[r] = r;
      dfs_hld(r, -1, k);
    }
  }

  void dfs_sz(int v, int p){
    if(g[v].size() && g[v][0] == p) swap(g[v][0], g[v].back());
    for(int& u: g[v]){
      if(u == p) continue;
      dfs_sz(u, v);
      subtr[v] += subtr[u];
      if(subtr[u] > subtr[g[v][0]]) swap(u, g[v][0]);
    }
  }

  void dfs_hld(int v, int p, int& k){
    par[v] = p; vid[v] = k++;
    for(auto u: g[v]){
      if(u == p) continue;
      head[u] = (u == g[v][0] ? head[v] : u);
      dfs_hld(u, v, k);
    }
  }

  /* パス(u,v)上の頂点クエリ*/
  void for_each(int u, int v, const function<void(int, int)>& f){
    while(1){
      if(vid[u] > vid[v]) swap(u, v);
      f(max(vid[head[v]], vid[u]), vid[v]);
      if(head[u] != head[v]) v = par[head[v]];
      else break;
    }
  }

  /* パス(u,v)上の辺クエリ */
  void for_each_edge(int u, int v, const function<void(int, int)>& f){
    while(1){
      if(vid[u] > vid[v]) swap(u,v);
      if(head[u] != head[v]){
        f(vid[head[v]], vid[v]);
        v = par[head[v]];
      } else {
        if(u != v) f(vid[u]+1, vid[v]);
        break;
      }
    }
  }

  int lca(int u, int v){
    while(1){
      if(vid[u] > vid[v]) swap(u,v);
      if(head[u] == head[v]) return u;
      v = par[head[v]];
    }
  }
};
template<typename T = int> struct SegmentTree{
private:
  // [val, index]
  vector<ll> node;
  int n, sz;

public:
  void resize(vector<T>& v){
    sz = v.size();
    n = 1;
    while(n < sz) n*=2;
    node.resize(2*n);
    for(int i=0; i<sz; i++){
      node[i+n] = v[i];
    }
    for(int i=n-1; i>=1; i--){
      node[i] = min(node[2*i], node[2*i+1]);
    }
  }

  void update(int k, T a){
    k += n;
    
    node[k] += a;
    while(k >>= 1){
      node[k] = node[2*k] + node[2*k+1];
    }
  }

  // [a, b)について求める
  ll query(int a, int b){

    ll res = 0;

    a += n, b += n;
    while(a != b){
      if(a % 2) res += node[a++];
      if(b % 2) res += node[--b];
      a >>= 1, b >>= 1;
    }
    return res;
  }
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(5);
  
  int N, Q; cin >> N >> Q;
  vector<ll> v(N);

  SegmentTree<ll> seg;
  seg.resize(v);
  for(int i=0; i<Q; i++){
    int q;
    ll x, y; cin >> q >> x >> y;
    x--;
    if(q == 0){
      seg.update(x, y);
    }else{
      cout << seg.query(x, y) << endl;

    }
  }
  return 0;
}



Measured memory_bytes: 5740