#include <bits/stdc++.h>
int main() {
  long long buf[100100];
  int m, n;
  long long mod = 0;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%I64d", buf + i);
  while (m--) {
    long long opr, val;
    long long des;
    scanf("%I64d", &opr);
    if (opr == 1) {
      scanf("%I64d%I64d", &des, &val);
      buf[des - 1] = val - mod;
    } else if (opr == 2) {
      scanf("%I64d", &val);
      mod += val;
    } else {
      scanf("%I64d", &des);
      printf("%I64d\n", buf[des + -1] + mod);
    }
  }
  return 0;
}
