#include <bits/stdc++.h>
using namespace std;
void cicada() {
  long long i, j, k, l, m, n;
  cin >> n >> m;
  vector<long long> v(n);
  for (i = 0; i < n; i++) cin >> v[i];
  j = 0;
  while (m--) {
    long long a, b;
    cin >> a >> b;
    if (a == 1) {
      long long c;
      cin >> c;
      v[b - a] = c - j;
    } else if (a == 2) {
      j += b;
    } else
      cout << v[b - 1] + j << endl;
  }
}
int main() {
  long long test = 1;
  while (test--) {
    cicada();
  }
}
