#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, i, j, k, c, d, e, f, g;
  cin >> n >> m;
  long long int a[n + 1], b[m + 1], x[n + 1];
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    x[i] = 0;
  }
  d = 0;
  g = 0;
  for (i = 0; i < m; i++) {
    cin >> c >> e;
    if (c == 1) {
      cin >> f;
      a[e] = f;
      x[e] = d;
    }
    if (c == 2) d = d + e;
    if (c == 3) {
      b[g++] = a[e] + d - x[e];
    }
  }
  for (i = 0; i < g; i++) cout << b[i] << endl;
  return 0;
}
