#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
vector<string>split(string s, char c = ' ') {
	vector<string>vec;
	string h = "";
	for (int i = 0; i < s.size();) {
		int j = i;
		while (j < s.size() && s[j] != ' ') {
			h += s[j++];
		}
		if (h.size() > 0) vec.push_back(h);
		h = "";
		i = j + 1;
	}
	return vec;
}
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
class Segtree {
public:
	//本値、足す値、変える値、変えない、変えてから足す、問答無用で変える
	struct A { int x, y, z, w; };
	//mode=0: MAX,  mode=1: MIN, mode=2: Sum
	int size, tmp, mode, num;
	A dat[1000000];
	Segtree(int mode) :mode(mode) {	}
	void init(int n) {
		size = n;
		if (mode == 0) num = -Inf;
		else if (mode == 1) num = Inf;
		else num = 0;
		for (int i = 0; i < 2 * n; i++) {
			dat[i].x = num;
		}
		tmp = 1;
		while (tmp < size) tmp *= 2;
	}
	//区間l~rにxを加算する
	void add(int l, int r, int x) {
		seg_add(0, l, r, 0, tmp, x);
	}
	void change(int l, int r, int x) {
		seg_change(0, l, r, 0, tmp, x);
	}
	int query(int l, int r) {
		return seg_query(0, l, r, 0, tmp);
	}
private:
	void eval(int i, int l, int r) {
		//変えない、変えてから足す、足さずに変える
		if (dat[i].w == 0) {
			if (mode == 2)
				dat[i].x += (min(r, size) - l) * dat[i].y;
			else
				dat[i].x += dat[i].y;
			if (r - l > 1) {
				if (dat[i * 2 + 1].w == 2) {
					dat[i * 2 + 1].y = 0;
					dat[i * 2 + 1].w = 1;
				}
				dat[i * 2 + 1].y += dat[i].y;
				if (dat[i * 2 + 2].w == 2) {
					dat[i * 2 + 2].y = 0;
					dat[i * 2 + 2].w = 1;
				}
				dat[i * 2 + 2].y += dat[i].y;
			}
		}
		else if (dat[i].w == 1) {
			dat[i].x = dat[i].z + (min(size, r) - l) * dat[i].y;
			if (r - l > 1) {
				dat[i * 2 + 1].w = 2, dat[i * 2 + 1].z = dat[i].x;
				dat[i * 2 + 2].w = 2, dat[i * 2 + 2].z = dat[i].x;
			}
		}
		else {
			dat[i].x = dat[i].z;
			dat[i].w = 0;
			if (r - l > 1) {
				dat[i].x = dat[i].z;
				dat[i * 2 + 1].w = 2, dat[i * 2 + 1].z = dat[i].z;
				dat[i * 2 + 2].w = 2, dat[i * 2 + 2].z = dat[i].z;
			}
		}
		dat[i].y = 0, dat[i].w = 0;
	}
	void seg_add(int i, int a, int b, int l, int r, int x) {
		eval(i, l, r);
		if (r <= a || b <= l) return;
		if (a <= l && r <= b) {
			if (dat[i].w == 2)dat[i].w = 1;
			dat[i].y = x;
			eval(i, l, r);
			return;
		}
		seg_add(i * 2 + 1, a, b, l, (l + r) / 2, x);
		seg_add(i * 2 + 2, a, b, (l + r) / 2, r, x);
		if (mode == 0) {
			dat[i].x = max(dat[i * 2 + 1].x, dat[i * 2 + 2].x);
		}
		else if (mode == 1) {
			dat[i].x = min(dat[i * 2 + 1].x, dat[i * 2 + 2].x);
		}
		else {
			dat[i].x = dat[i * 2 + 1].x + dat[i * 2 + 2].x;
		}
	}
	void seg_change(int i, int a, int b, int l, int r, int x) {
		eval(i, l, r);
		if (r <= a || b <= l) return;
		if (a <= l && r <= b) {
			dat[i].z = x;
			dat[i].w = 2;
			eval(i, l, r);
			return;
		}
		seg_change(i * 2 + 1, a, b, l, (l + r) / 2, x);
		seg_change(i * 2 + 2, a, b, (l + r) / 2, r, x);
		if (mode == 0) {
			dat[i].x = max(dat[i * 2 + 1].x, dat[i * 2 + 2].x);
		}
		else if (mode == 1) {
			dat[i].x = min(dat[i * 2 + 1].x, dat[i * 2 + 2].x);
		}
		else {
			dat[i].x = dat[i * 2 + 1].x + dat[i * 2 + 2].x;
		}
	}
	int seg_query(int i, int a, int b, int l, int r) {
		if (r <= a || b <= l) return num;
		if (a <= l && r <= b) return dat[i].x;
		int sum = num;
		if (mode == 0) {
			sum = max(seg_query(i * 2 + 1, a, b, l, (l + r) / 2),
				seg_query(i * 2 + 2, a, b, (l + r) / 2, r));
		}
		else if (mode == 1) {
			sum = min(seg_query(i * 2 + 1, a, b, l, (l + r) / 2),
				seg_query(i * 2 + 2, a, b, (l + r) / 2, r));
		}
		else {
			sum = sum = seg_query(i * 2 + 1, a, b, l, (l + r) / 2) +
				seg_query(i * 2 + 2, a, b, (l + r) / 2, r);
		}
		return sum;
	}
};
int a[200000];
Segtree seg(2);
signed main() {
	int n, q;
	cin >> n >> q;
	seg.init(n);
	for (int i = 0; i < q; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		if (a == 0) seg.add(b - 1, b, c);
		else cout << seg.query(b - 1, c) << endl;
	}
}


Measured memory_bytes: 10324