#include <bits/stdc++.h>
int main() {
  int n, m, t, v, x, y, q, to_sum;
  to_sum = 0;
  scanf("%d %d", &n, &m);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < m; i++) {
    scanf("%d", &t);
    switch (t) {
      case 1:
        scanf("%d %d", &v, &x);
        a[v - 1] = x - to_sum;
        break;
      case 2:
        scanf("%d", &y);
        to_sum += y;
        break;
      case 3:
        scanf("%d", &q);
        printf("%d\n", a[q - 1] + to_sum);
        break;
      default:
        break;
    }
  }
  return 0;
}
