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