#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long> input;
  long long n, m, op, t, v, x, y;
  cin >> n >> m;
  while (n--) {
    cin >> t;
    input.push_back(t);
  }
  long long inc = 0;
  while (m--) {
    cin >> op;
    if (op == 1) {
      cin >> v >> x;
      input[v - 1] = x;
      input[v - 1] -= inc;
      continue;
    }
    if (op == 2) {
      cin >> y;
      inc += y;
      continue;
    }
    if (op == 3) {
      cin >> y;
      cout << input[y - 1] + inc << endl;
    }
  }
  return 0;
}
