#include<stdio.h>
#define ST_SIZE ((1 << 18) - 1)
typedef long long int LL;
LL dat[ST_SIZE];
LL input(void);
void add(LL a, LL b, int x, LL k, LL l, LL r);
void get(LL k, LL n);
int main (void) {
  int command, x;
  LL i, n, q, s, t, n2 = 1;
  n = input();
  q = input();
  while (n2 < n) n2 *= 2;
  n = n2;
  for (i = 0; i < q; i++) {
    command = input();
    if (!command) {
      s = input();
      t = input();
      x = input();
      add(s - 1, t, x, 0, 0, n);
    } else {
      t = input();
      get(t - 1, n);
    }
  }
}
LL input(void)
{
  LL n = 0;
  int c = getchar_unlocked();
  if (c == '-') {
    c = getchar_unlocked();
    do {
      n = 10 * n + c - '0';
      c = getchar_unlocked();
    } while (c >= '0' && c <= '9');
    return -n;
  } else {
    do {
      n = 10 * n + c - '0';
      c = getchar_unlocked();
    } while (c >= '0' && c <= '9');
    return n;
  }
}
void add(LL a, LL b, int x, LL k, LL l, LL r)
{
  if (a >= r || b <= l) return;
  else if (a <= l && b >= r) dat[k] += x;
  else {
    add(a, b, x, k * 2 + 1, l, (l + r) / 2);
    add(a, b, x, k * 2 + 2 , (l + r) / 2, r);
  }
}
void get(LL k, LL n)
{
  LL res;
  k += n - 1;
  res = dat[k];
  while (k > 0) {
    k = (k - 1)/ 2;
    res += dat[k];
  }
  printf("%lld\n", res);
}
