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