#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  vector<int> update(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    update[i] = 0;
  }
  int accumalated = 0;
  for (int i = 0; i < m; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      int v, x;
      cin >> v >> x;
      a[v - 1] = x;
      update[v - 1] = accumalated;
    } else if (t == 2) {
      int y;
      cin >> y;
      accumalated += y;
    } else {
      int q;
      cin >> q;
      cout << a[q - 1] + accumalated - update[q - 1] << endl;
    }
  }
  return 0;
}
