#include <bits/stdc++.h>
using namespace std;
int myr[8] = {-1, 0, 1, 0, -1, 1, -1, 1};
int myc[8] = {0, 1, 0, -1, 1, -1, -1, 1};
int LMAX = 2147483647;
int LMIN = -2147483647;
int mo = 1000000007;
int n, m;
int f[100002];
int p[100002];
int c, x, y;
int a = 0;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &f[i]);
  while (m--) {
    scanf("%d%d", &c, &x);
    if (c == 3) {
      printf("%d\n", f[x] + a - p[x]);
    } else if (c == 2) {
      a += x;
    } else if (c == 1) {
      scanf("%d", &y);
      f[x] = y;
      p[x] = a;
    }
  }
  return 0;
}
