/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-04-07 18:36:29
 **/

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

template <class T>
using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  os << '{';
  int n = vec.size();
  for (int i = 0; i < n; ++i) {
    os << vec[i];
    if (i != n - 1) os << ',';
  }
  os << '}';
  return os;
}
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '{' << p.first << " " << p.second << '}';
}
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  os << '{';
  for (auto it = mp.begin(); it != mp.end(); ++it) {
    os << '{' << it->first << ':' << it->second << '}';
    if (it != --mp.end()) os << ',';
  }
  os << '}';
  return os;
}
template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  os << '{';
  for (auto it = st.begin(); it != st.end(); ++it) {
    os << *it;
    if (it != --st.end()) os << ',';
  }
  os << '}';
  return os;
}
template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  int n = vec.size();
  for (int i = 0; i < n; ++i) is >> vec[i];
  return is;
}

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

template <class _Tp>
class FenwickTree {
 public:
  FenwickTree(const std::vector<_Tp>& data) : n_(data.size() + 1), data_(data) {
    initialize();
  }

  void add(int pos, _Tp value) {
    ++pos;
    while (pos < n_) {
      node_[pos] += value;
      pos += pos & -pos;
    }
  }

  // return sum of [0, i]
  _Tp get(int pos) {
    ++pos;
    _Tp sum = 0;
    while (pos > 0) {
      sum += node_[pos];
      pos -= pos & -pos;
    }
    return sum;
  }

  // return sum of [l, rihgt]
  _Tp get(int l, int r) { return get(r) - get(l - 1); }

  // for range add query
  class RAQ {
   public:
    RAQ(const std::vector<_Tp>& data)
        : n_(data.size()),
          ft1_(FenwickTree<_Tp>(data)),
          ft2_(FenwickTree<_Tp>(data)) {}

    // add value range [l, r)
    void add(int l, int r, _Tp value) {
      add(ft1_, l, r, value);
      add(ft2_, l, r, -value * static_cast<_Tp>(l - 1));
      add(ft2_, r, n_, value * static_cast<_Tp>(r - l));
    }

    // get sum of [0, i]
    _Tp get(int pos) {
      return ft1_.get(pos) * static_cast<_Tp>(pos) + ft2_.get(pos);
    }

    // get sum of [l, r]
    _Tp get(int l, int r) { return get(r) - get(l - 1); }

   private:
    int n_;
    FenwickTree<_Tp> ft1_;
    FenwickTree<_Tp> ft2_;
    void add(FenwickTree<_Tp>& ft, int l, int r, _Tp value) {
      ft.add(l, value);
      ft.add(r, -value);
    }
  };

 private:
  int n_;
  std::vector<_Tp> data_;
  std::vector<_Tp> node_;
  void initialize() {
    node_.assign(n_ + 1, 0);
    for (int i = 0; i < n_ - 1; ++i) add(i, data_[i]);
  }
};

void DSL_2_B() {
  int n, q;
  cin >> n >> q;
  FenwickTree<int> ft(vector<int>(n, 0));
  for (int i = 0; i < q; ++i) {
    int com, x, y;
    cin >> com >> x >> y;
    if (com == 0) {
      ft.add(x - 1, y);
    } else {
      cout << ft.get(x - 1, y - 1) << '\n';
    }
  }
}

void DSL_2_G() {
  int n, q;
  cin >> n >> q;
  FenwickTree<int64>::RAQ ft(vector<int64>(n, 0));
  for (int i = 0; i < q; ++i) {
    int com;
    cin >> com;
    if (com == 0) {
      int s, t, x;
      cin >> s >> t >> x;
      ft.add(s - 1, t, x);
    } else {
      int s, t;
      cin >> s >> t;
      cout << ft.get(s - 1, t - 1) << '\n';
    }
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  DSL_2_B();
  // DSL_2_G();

  return 0;
}


Measured memory_bytes: 4132