// Slower C++ solution:
#include <bits/stdc++.h>



//{{{ bit.hpp

#ifndef INCLUDE_BIT_HPP

#define INCLUDE_BIT_HPP

#include <vector>

namespace orislib {

namespace ds {

template<typename T>

struct BIT {

  std::vector<T> A;

  BIT(int n):A(n, 0){}

  T query(int l,int r){

    if (l) return query(0,r-1)-query(0,l-1);

    T S=0;

    for(;r>=0;r=(r&r+1)-1)S+=A[r];

    return S;

  }

  void add(int k,T a){

    for(int last=A.size();k<last;k|=k+1)A[k]+=a;

  }

};

}

}

#endif

//}}}



using namespace orislib::ds;

using namespace std;



typedef long long ll;

typedef long double ld;

typedef tuple<int, int> duo;

//{{{ templates

#define TMPINL_(...) template<__VA_ARGS__>inline

#define TT_ TMPINL_(typename T)

#define TTF_ TMPINL_(typename T,typename F)

#define TTTS_ TMPINL_(typename T,typename...Ts)

#define TITS_ TMPINL_(size_t I=0,typename...Ts)

TT_ T sq(T x){return x*x;}

TT_ T In(){T x;cin>>x;return x;}

TT_ void Out(T&x){cout<<x;}

TT_ void sort(T&v){sort(begin(v),end(v));}

TT_ void revs(T&v){reverse(begin(v),end(v));}

TT_ void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));}

TT_ int ubnd(T&v,typename T::value_type&x){return upper_bound(begin(v),end(v),x)-begin(v);}

TT_ int lbnd(T&v,typename T::value_type&x){return lower_bound(begin(v),end(v),x)-begin(v);}

TTF_ void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));}

TTF_ void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;}

TITS_ typename enable_if<I==tuple_size<tuple<Ts...>>::value-1,string>::type join(string s,tuple<Ts...>t){return to_string(get<I>(t));}

TITS_ typename enable_if<I<tuple_size<tuple<Ts...>>::value-1,string>::type join(string s,tuple<Ts...>t){return to_string(get<I>(t))+s+join<I+1>(s,t);}

TT_ string join(string s,T t){return to_string(t);}

TTTS_ string join(string s,T t,Ts...ts){return join(s,t)+s+join(s,ts...);}



inline void fast_io(){ios::sync_with_stdio(0);cin.tie(0);}

inline int in(){int x;scanf("%d",&x);return x;}

inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}

inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);}

inline int puts(const string&s){ return puts(s.c_str()); }

//}}} priority_queue queue deque front stringstream max_element min_element insert count make_tuple

const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};

const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};

const int Mod = 1000000000 + 0;



int main()

{

  BIT<int> seg(100000);

  int n, q;

  n = in(), q = in();

  for (int i = 0; i < q; i++){

    int a, b, c;

    a = in(), b = in(), c = in();

    if (a) printf("%d\n", seg.query(b, c + 1));

    else seg.add(b, c);

  }

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.5264925453287777x):
#include <algorithm>

#include <vector>



template <typename T>

struct BIT {

  using value_type = T;

  using Index1 = int;

  std::vector<value_type> A;

  const int N, N2;

  BIT(int N) : A(N + 1, 0), N(N), N2(1 << std::__lg(N)) {}

  void add(Index1 a, value_type w) {

    for (Index1 x = a; x <= N; x += x & -x) {

      A[x] += w;

    }

  }

  value_type sum(Index1 a) const {

    value_type ret = 0;

    for (Index1 x = a; x > 0; x -= x & -x) {

      ret += A[x];

    }

    return ret;

  }

  Index1 lower_bound(value_type w) const {

    if (w <= 0) return 0;

    Index1 x = 0;

    for (int k = N2; k > 0; k >>= 1) {

      if (x + k <= N && A[x + k] < w) {

        w -= A[x + k];

        x += k;

      }

    }

    return x + 1;

  }

};





#include <cstdio>



#define mygc(c) (c) = getchar_unlocked()

#define mypc(c) putchar_unlocked(c)



template<typename T=int>T rd(){T x=0,m=0,k;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||'9'<k)break;x=x*10+k-'0';}return x;}

template<typename T=int>void wr(T x,char c='\n'){int s=0,m=0;char b[32];if(x<0)m=1,x=-x;for(;x;x/=10)b[s++]=x%10;if(!s)b[s++]=0;if(m)mypc('-');for(;s--;)mypc(b[s]+'0');mypc(c);}



int main() {

  int N = rd(), Q = rd();

  BIT<int> bit(N);

  for (int i = 0; i < Q; i++) {

    int c = rd(), x = rd(), y = rd();

    if (c == 0) {

      bit.add(x, y);

    } else {

      wr(bit.sum(y) - bit.sum(x - 1));

    }

  }

}