#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  long long a[n + 1];
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long v, x, add = 0, y, q;
  int t;
  while (m--) {
    cin >> t;
    if (t == 1) {
      cin >> v >> x;
      a[v] = x - add;
    } else if (t == 2) {
      cin >> y;
      add += y;
    } else {
      cin >> q;
      cout << a[q] + add << "\n";
    }
  }
  return 0;
}
