#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long N, D[100009], M, A, B, X, S = 0;
  cin >> N >> M;
  for (long i = 0; i < N; i++) cin >> D[i];
  while (M--) {
    cin >> A >> B;
    if (A == 1) {
      cin >> X;
      D[B - 1] = (X - S);
    } else if (A == 2)
      S += B;
    else
      cout << D[B - 1] + S << "\n";
  }
  return 0;
}
