#include <bits/stdc++.h>
using namespace std;

const int bB = 8;
const int B = 1 << bB;

int up(int x) {
	return (x + (1 << bB) - 1) >> bB;
}

int down(int x) {
	return x >> bB;
}

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int n, q;
	cin >> n >> q;
	const int H = up(n);
	vector<int> bv(H, 0), v(n, 0);
	while (q--) {
		int com;
		cin >> com;
		if (com) {
			int x;
			cin >> x; x--;
			printf("%d\n", bv[down(x)] + v[x]);
		}
		else {
			int x, y, val;
			cin >> x >> y >> val; x--;
			for (int i = x; i < y && i < (up(x) << bB); i++) {
				v[i] += val;
			}
			if (up(x) <= down(y)) {
				for (int i = up(x); i < down(y); i++) {
					bv[i] += val;
				}
				for (int i = down(y) << bB; i < y; i++) {
					v[i] += val;
				}
			}
		}
	}
	return 0;
}

