#include <bits/stdc++.h>
int main() {
  int n, m, sum = 0, arr[100010], i;
  scanf("%d %d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", &arr[i]);
  while (m--) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int v, x;
      scanf("%d %d", &v, &x);
      arr[v] = x - sum;
    } else if (t == 2) {
      int y;
      scanf("%d", &y);
      sum = sum + y;
    } else if (t == 3) {
      int q;
      scanf("%d", &q);
      printf("%d\n", arr[q] + sum);
    }
  }
  return 0;
}
