#include <bits/stdc++.h>
long long b[100005];
struct node {
  int x, y;
  long long flag;
  long long sum;
} a[100005 * 3];
void CreatTree(int t, int x, int y) {
  a[t].x = x;
  a[t].y = y;
  a[t].flag = 0;
  if (x == y) {
    a[t].sum = b[x];
    return;
  }
  int temp = t * 2;
  int mid = (a[t].x + a[t].y) / 2;
  CreatTree(temp, x, mid);
  CreatTree(temp + 1, mid + 1, y);
  return;
}
void InsertTree(int t, int x, int y, int k, int tt) {
  if (a[t].x == x && a[t].y == y) {
    if (tt == 2)
      a[t].flag += k;
    else if (tt == 1) {
      a[t].sum = k;
      a[t].flag = 0;
    }
    return;
  }
  int temp = t * 2;
  int mid = (a[t].x + a[t].y) / 2;
  if (a[t].flag) {
    a[temp].flag += a[t].flag;
    a[temp + 1].flag += a[t].flag;
    a[t].flag = 0;
  }
  if (x <= mid)
    InsertTree(temp, x, y, k, tt);
  else
    InsertTree(temp + 1, x, y, k, tt);
  return;
}
long long FindTree(int t, int x) {
  if (a[t].x == a[t].y) {
    a[t].sum += a[t].flag;
    a[t].flag = 0;
    return a[t].sum;
  }
  int temp = t * 2;
  int mid = (a[t].x + a[t].y) / 2;
  if (a[t].flag) {
    a[temp].flag += a[t].flag;
    a[temp + 1].flag += a[t].flag;
    a[t].flag = 0;
  }
  if (x <= mid)
    return FindTree(temp, x);
  else
    return FindTree(temp + 1, x);
}
int main() {
  int n, m;
  while (scanf("%d%d", &n, &m) != EOF) {
    for (int i = 1; i <= n; i++) scanf("%I64d", &b[i]);
    CreatTree(1, 1, n);
    while (m--) {
      int k, x, y;
      scanf("%d", &k);
      if (k == 1) {
        scanf("%d%d", &x, &y);
        InsertTree(1, x, x, y, k);
      } else if (k == 2) {
        scanf("%d", &x);
        InsertTree(1, 1, n, x, k);
      } else if (k == 3) {
        scanf("%d", &x);
        printf("%I64d\n", FindTree(1, x));
      }
    }
  }
  return 0;
}
