// Slower C++ solution:
#define NDEBUG

#include <cassert>

#include <cstdint>

#include <functional>

#include <vector>



template <typename Abelian> class FenwickTree {

	using uint32 = std::uint_fast32_t;

	using const_reference = const Abelian &;

	using F = std::function<Abelian(const_reference, const_reference)>;

	const Abelian neutral_;

	const F p, m;

	std::vector<Abelian> tree;



public:

	FenwickTree(const uint32 size, const_reference neutral = Abelian(),

		const F &p = std::plus<Abelian>(),

		const F &m = std::minus<Abelian>())

		: neutral_(neutral), p(p), m(m), tree(size + 1, neutral_) {}

	FenwickTree(const uint32 size, const_reference neutral, const F &p,

		const std::function<Abelian(const_reference)> &n)

		: neutral_(neutral), p(p),

		m([&p, &n](const_reference l, const_reference r) { return p(l, n(r)); }),

		tree(size + 1, neutral_) {}

	void update(uint32 index, const std::function<void(Abelian)> &g) {

		assert(index < tree.size() - 1);

		++index;

		const Abelian a = tree[index];

		g(tree[index]);

		const_reference b = tree[index];

		while ((index += index & ~index + 1) < tree.size())

			tree[index] = p(m(tree[index], a), b);

	}

	void update(uint32 index, const_reference data) {

		update(index, [&data](Abelian &d) { d = data; });

	}

	void add(uint32 index, const_reference diff) {

		assert(index < tree.size() - 1);

		++index;

		do

			tree[index] = p(tree[index], diff);

		while ((index += index & ~index + 1) < tree.size());

	}

	Abelian range(uint32 end) const {

		assert(end < tree.size());

		Abelian ret = neutral_;

		do

			ret = p(tree[end], ret);

		while (end &= end - 1);

		return ret;

	}

	Abelian range(uint32 begin, uint32 end) const {

		assert(begin <= end);

		return m(range(end), range(begin));

	}

	Abelian operator[](uint32 index) const {

		assert(index < tree.size() - 1);

		return range(index, index + 1);

	}

};



#include <iostream>

int main(void) {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	int n, q;

	std::cin >> n >> q;

	FenwickTree<int> T(n, 0);

	while (q--) {

		int c, x, y;

		std::cin >> c >> x >> y;

		if (c) {

			std::cout << T.range(x - 1, y) << "\n";

		}

		else {

			T.add(x-1,y);

		}

	}

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.1124974212264895x):
#define NDEBUG

#include <cassert>

#include <cstdint>

#include <functional>

#include <vector>



template <typename Abelian> class FenwickTree {

	using uint32 = std::uint_fast32_t;



public:

	using value_type = Abelian;

	using reference = Abelian &;

	using const_reference = const Abelian &;



private:

	using F = std::function<value_type(const_reference, const_reference)>;

	const value_type neutral_;

	const F p, m;

	const uint32 size_;

	std::vector<value_type> tree;

	static uint32 getsize(const uint32 size) {

		uint32 ret = 1;

		while (ret < size)

			ret <<= 1;

		return ret;

	}



public:

	FenwickTree(const uint32 size, const_reference neutral = value_type(),

		const F &p = std::plus<value_type>(),

		const F &m = std::minus<value_type>())

		: neutral_(neutral), p(p), m(m), size_(getsize(size)),

		tree(size_ + 1, neutral_) {}

	FenwickTree(const uint32 size, const_reference neutral, const F &p,

		const std::function<value_type(const_reference)> &n)

		: neutral_(neutral), p(p),

		m([&p, &n](const_reference l, const_reference r) {

		return p(l, n(r));

	}),

		size_(getsize(size)), tree(size_ + 1, neutral_) {}

	void update(uint32 index, const std::function<void(reference)> &g) {

		assert(index < size_);

		++index;

		const value_type a = tree[index];

		g(tree[index]);

		const_reference b = tree[index];

		while ((index += index & ~index + 1) <= size_)

			tree[index] = p(m(tree[index], a), b);

	}

	void update(uint32 index, const_reference data) {

		update(index, [&data](reference d) { d = data; });

	}

	void add(uint32 index, const_reference diff) {

		assert(index < size_);

		for (++index; index <= size_; index += index & ~index + 1)

			tree[index] = p(tree[index], diff);

	}

	value_type range(uint32 end) const {

		assert(end <= size_);

		value_type ret = neutral_;

		do

			ret = p(tree[end], ret);

		while (end &= end - 1);

		return ret;

	}

	value_type range(uint32 begin, uint32 end) const {

		assert(begin <= end);

		return m(range(end), range(begin));

	}

	uint32 search(const std::function<bool(const_reference)> &b) const {

		if (!b(tree.back()))

			return size_;

		uint32 i = size_ >> 1;

		value_type acc = neutral_;

		for (uint32 k = size_ >> 1; k; k >>= 1)

			if (!b(p(acc, tree[i -= k])))

				acc = p(acc, tree[i]), i += k;

		return i - 1;

	}

	value_type operator[](uint32 index) const {

		assert(index < size_);

		return range(index, index + 1);

	}

};



//#define NDEBUG

#define _CRT_SECURE_NO_WARNINGS

#include <algorithm>

#include <array>

#include <cassert>

#include <climits>

#include <cmath>

#include <cstdint>

#include <cstdio>

#include <cstdlib>

#include <ctime>

#include <functional>

#include <limits>

#include <map>

#include <memory>

#include <numeric>

#include <queue>

#include <set>

#include <stack>

#include <string>

#include <type_traits>

#include <utility>

#include <vector>

constexpr double PI = 3.1415926535897932;



using int32 = std::int_fast32_t;

using int64 = std::int_fast64_t;

using uint32 = std::uint_fast32_t;

using uint64 = std::uint_fast64_t;

using intl32 = std::int_least32_t;

using intl64 = std::int_least64_t;

using uintl32 = std::uint_least32_t;

using uintl64 = std::uint_least64_t;



const char *yes(bool c) { return c ? "yes" : "no"; }

const char *Yes(bool c) { return c ? "Yes" : "No"; }

const char *YES(bool c) { return c ? "YES" : "NO"; }

const char *pos(bool c) { return c ? "possible" : "impossible"; }

const char *Pos(bool c) { return c ? "Possible" : "Impossible"; }

const char *POS(bool c) { return c ? "POSSIBLE" : "IMPOSSIBLE"; }

template<class T>bool bmaxi(T&a, const T&b) { if (b<a)return 0;a = b;return 1; }

template<class T>bool bmini(T&a, const T&b) { if (a<b)return 0;a = b;return 1; }

template<class T>bool nmaxi(T&a, const T&b) { if (a<b) { a = b;return 1; }return 0; }

template<class T>bool nmini(T&a, const T&b) { if (b<a) { a = b;return 1; }return 0; }

template<typename T>auto scan(T&d)->typename std::enable_if<std::is_signed<T>::value>::type

{

	d = 0;int c = fgetc(stdin);bool f = 0;while (c<'0' || '9'<c) { if (c == '-')f = 1;c = fgetc(stdin); }

	while (c != ' '&&c != '\n') { d = d * 10 + c - '0';c = fgetc(stdin); }if (f)d = -d;

}

template<typename T>auto scan(T&d)->typename std::enable_if<!std::is_signed<T>::value>::type

{

	d = 0;int c = fgetc(stdin);while (c == ' ' || c == '\n')c = fgetc(stdin);

	while (c != ' '&&c != '\n') { d = d * 10 + c - '0';c = fgetc(stdin); }

}

void scan(char&d) { d = fgetc(stdin);while (d == ' ' || d == '\n')d = fgetc(stdin); }

void scan(double&d) { scanf("%lf", &d); }void scan(std::string&d) {

	d.clear();int c = fgetc(stdin);

	while (c == ' ' || c == '\n')c = fgetc(stdin);while (c != ' '&&c != '\n') { d.push_back(c);c = fgetc(stdin); }

}

template<typename F, typename...R>void scan(F&f, R&...r) { scan(f);scan(r...); }

template<typename T>T input() { T d;scan(d);return d; }

template <typename T>auto print(T d)->typename std::enable_if<std::is_signed<T>::value>::type

{

	static int c[20];int i = 0;bool f = 0;if (d<0) { f = 1;d = -d; }while (d) { c[i++] = d % 10;d /= 10; }

	if (!i)c[i++] = 0;if (f)fputc('-', stdout);while (i--)fputc(c[i] + '0', stdout);

}

template<typename T>auto print(T d)->typename std::enable_if<!std::is_signed<T>::value>::type

{

	static int c[20];int i = 0;while (d) { c[i++] = d % 10;d /= 10; }

	if (!i)c[i++] = 0;while (i--)fputc(c[i] + '0', stdout);

}

template<>void print<char>(char d) { fputc(d, stdout); }

template<>void print<double>(double d) { printf("%f", d); }

template<>void print<char *>(char *c) { while (*c != '\0')fputc(*(c++), stdout); }void print() {}

template<typename F, typename...R>void print(F f, R...r) { print(f);print(r...); }

template<typename...R>void println(R...r) { print(r...);fputc('\n', stdout); }

template<typename...R>int END(R...r) { println(r...);return 0; }

int main(void) {

	uint32 n, q;

	scan(n, q);

	FenwickTree<uint32> T(n, 0);

	while (q--) {

		uint32 c, x, y;

		scan(c, x, y);

		if (c) {

			println(T.range(x - 1, y));

		}

		else {

			T.update(x - 1, [&](uint32 &d) {d += y;});

		}

	}

	return 0;

}