#include <cmath>
#include <cstdio>
#include <vector>
#pragma warning(disable : 4996)
using namespace std;
int N, Q;
int main() {
	scanf("%d%d", &N, &Q);
	vector<int> tp(Q), s(Q), t(Q), x(Q);
	for (int i = 0; i < Q; i++) {
		scanf("%d%d", &tp[i], &s[i]), s[i]--;
		if (tp[i] == 0) scanf("%d%d", &t[i], &x[i]);
	}
	int B = sqrt(Q);
	vector<int> d(N);
	for (int i = 0; i < B; i++) {
		int l = 1LL * i * Q / B, r = 1LL * (i + 1) * Q / B;
		for (int j = l; j < r; j++) {
			if (tp[j] == 1) {
				int sum = 0;
				for (int k = l; k < j; k++) {
					if (tp[k] == 0 && s[k] <= s[j] && s[j] < t[k]) sum += x[k];
				}
				printf("%d\n", d[s[j]] + sum);
			}
		}
		vector<int> imos(N + 1);
		for (int j = l; j < r; j++) {
			if (tp[j] == 0) {
				imos[s[j]] += x[j];
				imos[t[j]] -= x[j];
			}
		}
		int sum2 = 0;
		for (int j = 0; j < N; j++) {
			sum2 += imos[j];
			d[j] += sum2;
		}
	}
	return 0;
}