#include <vector>
using namespace std;


//Base class for Segment Trees
template <class T>
class segtree_base
{
protected:
	size_t width;
	vector<T> vec;
	T def;
	virtual T query_raw(int l_, int r_, int a_, int b_, int k_) = 0;
public:
	segtree_base(size_t size_, const T& def_ = T()) : def(def_)
	{
		width = 1;
		while (width < size_)width *= 2;
		vec.resize(width * 2 - 1, def);
	}
	T query(int left, int right)
	{
		return query_raw(left, right, 0, width, 0);
	}
	virtual ~segtree_base() {}
};

#include <algorithm>
//Range Minimum Tree
template <class T, class Comp>
class rmq_tree : public segtree_base<T>
{
public:
	rmq_tree(size_t size_) : segtree_base<T>(size_, Comp::defval)
	{}
	void update(int index, T val)
	{
		auto &vec = this->vec;
		index += (this->width - 1);
		vec[index] = val;
		while (index > 0)
		{
			index = (index - 1) / 2;
			vec[index] = min(vec[index * 2 + 1], vec[index * 2 + 2],Comp());
		}
	}
private:
	T query_raw(int l_, int r_, int a_, int b_, int k_)override
	{
		const auto &vec = this->vec;
		if (l_ <= a_ && b_ <= r_)
		{
			return vec[k_];
		}
		if (b_ <= l_ || r_ <= a_)
		{
			return this->def;
		}
		int m = (a_ + b_) / 2;
		return min(
			query_raw(l_, r_, a_, m, k_ + k_ + 1),
			query_raw(l_, r_, m, b_, k_ + k_ + 2),Comp());
	}
};


#include <algorithm>
//Range Sum + Range Add Tree
template <class T>
class rsaq_tree : public segtree_base<T>
{
protected:
	vector<T>lazy;
public:
	rsaq_tree(size_t size_, const T& def = 0) :segtree_base<T>(size_, def)
	{
		lazy.resize(this->vec.size());
	}
	void init(const vector<int>&base)
	{
		for (int i = 0; i < this->width; i++) this->vec[i + this->width - 1] = base[i];
		for (int i = this->width - 2; i >= 0; i--) this->vec[i] = this->vec[i * 2 + 1] + this->vec[i * 2 + 2];
	}
	void update(int left, int right, int val)
	{
		update_raw(left, right, val, 0, this->width, 0);
	}
private:
	void eval(int k_, int a_, int b_)
	{
		if (lazy[k_] != 0) {
			this->vec[k_] += lazy[k_];
			if (b_ - a_ > 1) {
				lazy[2 * k_ + 1] += lazy[k_] / 2;
				lazy[2 * k_ + 2] += lazy[k_] / 2;
			}
			lazy[k_] = 0;
		}
	}
	void update_raw(int l_, int r_, int x_, int a_, int b_, int k_)
	{
		eval(k_, a_, b_);
		if (r_ <= a_ || b_ <= l_) return;
		if (l_ <= a_ && b_ <= r_) {
			lazy[k_] += (b_ - a_) * x_;
			eval(k_, a_, b_);
		}
		else {
			update_raw(l_, r_, x_, a_, (a_ + b_) / 2, 2 * k_ + 1);
			update_raw(l_, r_, x_, (a_ + b_) / 2, b_, 2 * k_ + 2);
			this->vec[k_] = this->vec[2 * k_ + 1] + this->vec[2 * k_ + 2];
		}
	}
	T query_raw(int l_, int r_, int a_, int b_, int k_)override
	{
		eval(k_, a_, b_);
		if (r_ <= a_ || b_ <= l_) return this->def;
		if (l_ <= a_ && b_ <= r_) return this->vec[k_];
		T vl = query_raw(l_, r_, a_, (a_ + b_) / 2, 2 * k_ + 1);
		T vr = query_raw(l_, r_, (a_ + b_) / 2, b_, 2 * k_ + 2);
		return vl + vr;
	}
};


#include <functional>

//Functors for Segment Trees
template <class T>
struct my_less : std::less<T> 
{
	static constexpr T defval = std::numeric_limits<T>::max();
};
template <class T>
struct my_greater : std::greater<T>
{
	static constexpr T defval = std::numeric_limits<T>::min();
};

#include <iostream>
#include <climits>

int main()
{
	int n, q;
	cin >> n >> q;
	rmq_tree<int, my_less<int>>rmq(n);
	for (int i = 0; i < q; ++i)
	{
		int com, x, y;
		cin >> com >> x >> y;
		if (com)
		{
			cout << rmq.query(x, y + 1) << endl;
		}
		else
		{
			rmq.update(x, y);
		}
	}
	return 0;
}

Measured memory_bytes: 3800