#include <bits/stdc++.h>
int b[100000];
int c[100000];
int r[100000];
int main() {
  long long int n, m, i, j, cnt, e, t, f, k, w;
  scanf("%lld %lld", &n, &m);
  int ara[100000];
  int a[100000][4];
  for (i = 0; i < n; i++) {
    scanf("%lld", &ara[i]);
  }
  for (i = 0; i < m; i++) {
    scanf("%lld", &a[i][0]);
    if (a[i][0] == 2 || a[i][0] == 3) {
      scanf("%lld", &a[i][1]);
    } else {
      scanf("%lld%lld", &a[i][1], &a[i][2]);
    }
  }
  cnt = 0;
  k = 0;
  t = 0;
  for (i = 0; i < m; i++) {
    if (a[i][0] == 1) {
      ara[a[i][1] - 1] = a[i][2];
      t++;
      if (r[a[i][1] - 1] == 0) {
        r[a[i][1] - 1] = 1;
        b[a[i][1] - 1] = a[i][1];
        c[a[i][1] - 1] = cnt;
      } else {
        c[a[i][1] - 1] = cnt;
      }
    } else if (a[i][0] == 2) {
      cnt = cnt + a[i][1];
    } else if (a[i][0] == 3) {
      f = 0;
      if (r[a[i][1] - 1] == 0) {
        printf("%lld\n", ara[a[i][1] - 1] + cnt);
      } else {
        printf("%lld\n", ara[a[i][1] - 1] + cnt - c[a[i][1] - 1]);
      }
    }
  }
  return 0;
}
