#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int add = 0;
  while (m--) {
    int q;
    cin >> q;
    if (q == 1) {
      int v, x;
      cin >> v >> x;
      a[v - 1] = x - add;
    } else if (q == 2) {
      int y;
      cin >> y;
      add += y;
    } else if (q == 3) {
      int z;
      cin >> z;
      cout << a[z - 1] + add << '\n';
    }
  }
}
