#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, sum = 0;
  cin >> n >> m;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int ff;
    cin >> ff;
    v.push_back(ff);
  }
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    if (x == 1) {
      int l, k;
      cin >> l >> k;
      v[l - 1] = k - sum;
    }
    if (x == 2) {
      int y;
      cin >> y;
      { sum += y; }
    }
    if (x == 3) {
      int ans;
      cin >> ans;
      cout << v[ans - 1] + sum << endl;
    }
  }
  return 0;
}
