// 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.1037778243807905x):
#define NDEBUG

#include <cassert>



template <class Monoid, template <class> class Container> class segment_tree {

public:

	using value_structure = Monoid;

	using value_type = typename value_structure::value_type;

	using container_type = Container<value_type>;

	using const_reference = typename container_type::const_reference;

	using size_type = typename container_type::size_type;



private:

	size_type size_, capacity;

	container_type c;

	static size_type getsize(const size_type size) {

		size_type ret = 1;

		while (ret < size)

			ret <<= 1;

		return ret;

	}

	void recalc(const size_type index) {

		c[index] = value_structure::operation(c[index << 1], c[index << 1 | 1]);

	}



public:

	segment_tree() : size_(0), capacity(0), c() {}

	explicit segment_tree(const size_type size)

		: size_(size), capacity(getsize(size_)),

		c(capacity << 1, value_structure::identity()) {}



	bool empty() const { return !size_; }

	size_type size() const { return size_; }



	const_reference operator[](const size_type index) const {

		assert(index < size());

		return c[index + capacity];

	}

	value_type fold(size_type first, size_type last) const {

		assert(first <= last);

		assert(first <= size());

		assert(last <= size());

		value_type ret_l = value_structure::identity(),

			ret_r = value_structure::identity();

		for (first += capacity, last += capacity; first < last;

			first >>= 1, last >>= 1) {

			if (first & 1)

				ret_l = value_structure::operation(ret_l, c[first++]);

			if (last & 1)

				ret_r = value_structure::operation(c[last - 1], ret_r);

		}

		return value_structure::operation(ret_l, ret_r);

	}

	template <class F> size_type search(const F &f) const {

		if (f(value_structure::identity()))

			return 0;

		if (!f(c[1]))

			return size() + 1;

		value_type acc = value_structure::identity();

		size_type i = 1;

		while (i < capacity)

			if (!f(value_structure::operation(acc, c[i <<= 1])))

				acc = value_structure::operation(acc, c[i++]);

		return i - capacity + 1;

	}



	void update(size_type index, const value_type &value) {

		assert(index < size());

		index += capacity;

		c[index] = value;

		while (index >>= 1)

			recalc(index);

	}

};



template <class T> class plus_monoid {

public:

	using value_type = T;

	static value_type operation(const value_type &x, const value_type &y) {

		return x + y;

	}

	static value_type identity() { return value_type(0); }

	static value_type reverse(const value_type &x) { return x; }

};



#include <cstdio>

#include <vector>



template<class T> using vec_alias = ::std::vector<T>;



int main() {

	using uint = unsigned int;



	uint n, q;

	scanf("%u%u", &n, &q);



	segment_tree<plus_monoid<uint>, vec_alias> seg(n);



	while (q--) {

		uint c, x, y;

		scanf("%u%u%u", &c, &x, &y);



		if (c)

			printf("%u\n", seg.fold(x - 1, y));

		else

			seg.update(x - 1, seg[x - 1] + y);

	}



	return 0;

}