#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

using namespace std;

class DelaySegmentTree {
private:
	class Monoid {
	public:
		long long value;
		int index;

		Monoid() {}
		Monoid(long long value, int index) : value(value), index(index) {}
	};

	vector<Monoid> nodes;
	vector<long long> delayValues;
	int maxDepth;			// 0-indexed

	Monoid func(const Monoid &m1, const Monoid &m2) {
		if (m1.index == -1 && m2.index == -1) return Monoid(0, -1);
		if (m1.index == -1) return m2;
		if (m2.index == -1) return m1;

		return Monoid(m1.value + m2.value, m1.index);
	}

	void calcNode(int idx) {
		if (idx >= (1 << maxDepth)) return;

		int left = idx << 1;
		int right = left + 1;

		nodes[idx] = func(nodes[left], nodes[right]);
	}

	void add(long long value, int l, int r, int idx, int minI, int maxI) {
		if (r < minI || maxI < l) return;
		
		int lchild = idx << 1;
		int rchild = lchild + 1;
		if (l <= minI && maxI <= r) {
			long long psum = value * (maxI - minI + 1);
			nodes[idx].value += psum;
			if (maxI != minI) {
				delayValues[lchild] += psum >> 1;
				delayValues[rchild] += psum >> 1;
			}
			return;
		}

		int border = (maxI + minI) >> 1;
		add(value, l, r, lchild, minI, border);
		add(value, l, r, rchild, border + 1, maxI);
		nodes[idx] = func(nodes[lchild], nodes[rchild]);
	}

	Monoid query(int l, int r, int idx, int minI, int maxI) {
		int lchild = idx << 1;
		int rchild = lchild + 1;

		if (r < minI || maxI < l) return Monoid(0, -1);

		if (delayValues[idx]) {
			if (idx < (1 << maxDepth)) {
				delayValues[lchild] += delayValues[idx] >> 1;
				delayValues[rchild] += delayValues[idx] >> 1;
			}
		}
		nodes[idx].value += delayValues[idx];
		delayValues[idx] = 0;

		if (l <= minI && maxI <= r) return nodes[idx];

		int border = (maxI + minI) >> 1;
		Monoid m1 = query(l, r, lchild, minI, border);
		Monoid m2 = query(l, r, rchild, border + 1, maxI);
		return func(m1, m2);
	}

public:
	DelaySegmentTree(const vector<int> &v) {
		maxDepth = 0;
		int len = 1;
		while (len < v.size()) {
			len <<= 1;
			maxDepth++;
		}
		nodes.resize(2 * len);
		delayValues.resize(2 * len);

		for (int i = 0; i < len; i++) {
			int idx = len + i;
			if (i < v.size()) {
				nodes[idx].value = v[i];
				nodes[idx].index = i;
			} else {
				nodes[idx].index = -1;
			}
		}

		for (int idx = len - 1; idx >= 1; idx--) {
			calcNode(idx);
		}
	}

	void add(long long value, int l, int r) {
		add(value, l, r, 1, 0, (1 << maxDepth) - 1);
	}

	Monoid query(int l, int r) {
		return query(l, r, 1, 0, (1 << maxDepth) - 1);
	}

	long long operator[] (int idx) {
		return query(idx, idx).value;
	}
};

int main() {
	int n, q;
	cin >> n >> q;

	vector<int> v(n);

	DelaySegmentTree tree(v);

	for (int i = 0; i < q; i++) {
		int type, x, y;
		scanf("%d %d %d", &type, &x, &y);

		if (type == 0) {
			tree.add(y, x - 1, x - 1);
		} else {
			printf("%d\n", tree.query(x - 1, y - 1).value);
		}
	}

    return 0;
}

//int main() {
//    int n, q;
//    cin >> n >> q;
// 
//    vector<int> v(n);
// 
//    DelaySegmentTree tree(v);
// 
//    for (int i = 0; i < q; i++) {
//        int type;
//        scanf("%d", &type);
// 
//        if (type == 0) {
//            int s, t, x;
//            scanf("%d %d %d", &s, &t, &x);
//            tree.add(x, s - 1, t - 1);
//        } else {
//            int t;
//            scanf("%d", &t);
//            printf("%d\n", tree[t - 1]);
//        }
//    }
// 
//    return 0;
//}



Measured memory_bytes: 9448