#include <iostream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <limits>
#include <algorithm>
#include <array>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <unordered_map>
#include <random>
#include <cmath>
#include <complex>
// #include "utiltime.hpp"

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef complex<double> cdouble;

const int INFL = (int)1e9;
const ll INFLL = (ll)1e18;
const double INFD = numeric_limits<double>::infinity();
const double PI = 3.14159265358979323846;
#define Loop(i, n) for(int i = 0; i < (int)(n); i++)
#define Loopll(i, n) for(ll i = 0; i < (ll)(n); i++)
#define Loop1(i, n) for(int i = 1; i <= (int)(n); i++)
#define Loopll1(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define Loopr(i, n) for(int i = (int)(n) - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = (ll)(n) - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)(n); i >= 1; i--)
#define Looprll1(i, n) for(ll i = (ll)(n); i >= 1; i--)
#define Foreach(buf, container) for(auto buf : container)
#define Loopdiag(i, j, h, w, sum) for(int i = ((sum) >= (h) ? (h) - 1 : (sum)), j = (sum) - i; i >= 0 && j < (w); i--, j++)
#define Loopdiagr(i, j, h, w, sum) for(int j = ((sum) >= (w) ? (w) - 1 : (sum)), i = (sum) - j; j >= 0 && i < (h); j--, i++)
#define Loopdiagsym(i, j, h, w, gap) for (int i = ((gap) >= 0 ? (gap) : 0), j = i - (gap); i < (h) && j < (w); i++, j++)
#define Loopdiagsymr(i, j, h, w, gap) for (int i = ((gap) > (h) - (w) - 1 ? (h) - 1 : (w) - 1 + (gap)), j = i - (gap); i >= 0 && j >= 0; i--, j--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(extra_i, vector.size()) { cout << vector[extra_i] << " "; } cout << endl;
#define printmx(matrix) Loop(extra_i, matrix.size()) { Loop(extra_j, matrix[extra_i].size()) { cout << matrix[extra_i][extra_j] << " "; } cout << endl; }
#define quickio() ios::sync_with_stdio(false); cin.tie(0);
#define readfile(filename) ifstream in(filename); cin.rdbuf(in.rdbuf());
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
#define Comp(type_t) bool operator<(const type_t &another) const
bool nearlyeq(double x, double y) { return abs(x - y) < 1e-9; }
bool inrange(int x, int t) { return x >= 0 && x < t; }
ll rndf(double x) { return (ll)(x + (x >= 0 ? 0.5 : -0.5)); }
ll floorsqrt(double x) { ll m = (ll)sqrt(x); return m + (m * m <= (ll)(x) ? 0 : -1); }
ll ceilsqrt(double x) { ll m = (ll)sqrt(x); return m + ((ll)x <= m * m ? 0 : 1); }
ll rnddiv(ll a, ll b) { return (a / b + (a % b * 2 >= b ? 1 : 0)); }
ll ceildiv(ll a, ll b) { return (a / b + (a % b == 0 ? 0 : 1)); }
ll gcd(ll m, ll n) { if (n == 0) return m; else return gcd(n, m % n); }
ll lcm(ll m, ll n) { return m * n / gcd(m, n); }

/*******************************************************/


template<class T>
class SegTree {
protected:
	int n, N; // n is the original size, while N is the extended size
	int base;
	vector<T> nodes;
	int left_of(int index) {
		if (index >= base) return -1;
		else return index * 2 + 1;
	}
	int right_of(int index) {
		if (index >= base) return -1;
		else return index * 2 + 2;
	}
	int parent_of(int index) {
		if (index == 0) return -1;
		else return (index - 1) / 2;
	}
	void local_update(int index, T(*update_rule)(T, T, T)) {
		if (index >= base) return;
		int l = left_of(index), r = right_of(index);
		nodes[index] = update_rule(nodes[index], nodes[l], nodes[r]);
	}
	void get_index_of_range_rec(int s, int t, int l, int r, int index, vi *v) {
		if (s == l && t == r) v->push_back(index);
		else {
			int mid = (l + r) / 2;
			if (s < mid && mid < t) {
				get_index_of_range_rec(s, mid, l, mid, left_of(index), v);
				get_index_of_range_rec(mid, t, mid, r, right_of(index), v);
			}
			else if (s < mid) get_index_of_range_rec(s, t, l, mid, left_of(index), v);
			else if (mid < t) get_index_of_range_rec(s, t, mid, r, right_of(index), v);
		}
	}
public:
	SegTree(int n, T init, T(*update_rule)(T, T, T)) {
		SegTree::n = n;
		N = (int)pow(2, ceil(log2(n)));
		base = N - 1;
		nodes = vector<T>(base + N, init);
	}
	// use either subst or update
	void subst(int index, T x, bool from_base = false) {
		if (from_base) index += base;
		nodes[index] = x;
	}
	void subst_range(int s, int t, T x) {
		vi indices = get_index_of_range(s, t);
		Foreach(index, indices) nodes[index] = x;
	}
	void subst_range(int s, int t, const vector<T> &x) {
		vi indices = get_index_of_range(s, t);
		Loop(i, x.size()) nodes[indices[i]] = x[i];
	}
	// use either subst or update
	void update(int index, T x, T(*update_rule)(T, T, T), bool from_base = false) {
		if (from_base) index += base;
		nodes[index] = x;
		while (index >= 0) {
			local_update(index, update_rule);
			index = parent_of(index);
		}
	}
	void update_range(int s, int t, T x, T(*update_rule)(T, T, T)) {
		vi indices = get_index_of_range(s, t);
		Foreach(index, indices) update(index, x, update_rule);
	}
	void update_range(int s, int t, const vector<T> &x, T(*update_rule)(T, T, T)) {
		vi indices = get_index_of_range(s, t);
		Loop(i, x.size()) update(indices[i], x[i], update_rule);
	}
	// note: range [s, t)
	vi get_index_of_range(int s, int t) {
		vi ret;
		get_index_of_range_rec(s, t, 0, N, 0, &ret);
		return ret;
	}
	// inclusive
	vi get_index_above(int index, bool from_base = false) {
		if (from_base) index += base;
		vi ret;
		while (index >= 0) {
			ret.push_back(index);
			index = parent_of(index);
		}
		return ret;
	}
	// get values
	T get(int index, bool from_base = false) {
		if (from_base) index += base;
		return nodes[index];
	}
	vector<T> get_range(int s, int t) {
		vector<T> ret;
		vi indices = get_index_of_range(s, t);
		Foreach(k, indices) ret.push_back(nodes[k]);
		return ret;
	}
	vector<T> get_above(int index, bool from_base = false) {
		vector<T> ret;
		vi indices = get_index_above(index, from_base);
		Foreach(k, indices) ret.push_back(nodes[k]);
		return ret;
	}
	int cover_size(int index) {
		int cnt = 1;
		while (left_of(index) != -1) {
			index = left_of(index);
			cnt *= 2;
		}
		int l = index - base;
		int r = min(l + cnt, n);
		return r - l;
	}
};

template<class T>
static T nop_rule(T x, T a, T b) {
	return x;
}

int update_rule(int x, int a, int b) {
	return min(a, b);
}

int main() {
	int n, q; cin >> n >> q;
	SegTree<ll> st(n, 0LL, nop_rule);
	Loop(unused, q) {
		int op; cin >> op;
		if (op == 0) {
			int s, t; cin >> s >> t; s--;
			ll x; cin >> x;
			vll a = st.get_range(s, t);
			Loop(i, a.size()) a[i] += x;
			st.subst_range(s, t, a);
		}
		else {
			int v; cin >> v; v--;
			vll a = st.get_above(v, true);
			cout << accumulate(a.begin(), a.end(), 0LL) << endl;
		}
	}
}


Measured memory_bytes: 5184