#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  cin.get();
  vector<long long> a(n + 1);
  for (long long i = 1; i < n + 1; ++i) {
    cin >> a[i];
  }
  cin.get();
  vector<long long> adds;
  adds.push_back(0);
  vector<long long> addfrom(n + 1);
  for (long long i = 1; i < n + 1; ++i) {
    addfrom[i] = 0;
  }
  long long op, v, q, res, asize;
  for (long long i = 1; i <= m; ++i) {
    cin >> op;
    asize = adds.size();
    switch (op) {
      case 1:
        cin >> v >> q;
        cin.get();
        a[v] = q;
        addfrom[v] = asize - 1;
        break;
      case 2:
        cin >> v;
        cin.get();
        adds.push_back(adds[asize - 1] + v);
        break;
      case 3:
        cin >> q;
        cin.get();
        res = a[q];
        if (addfrom[q] != asize - 1) {
          res += adds[asize - 1] - adds[addfrom[q]];
        }
        cout << res << endl;
        break;
    }
  }
  return 0;
}
