#include <bits/stdc++.h>
using namespace std;
int add[100005], val[100005];
int main() {
  int N, M, sup = 0, i, j, cod, index, x;
  cin >> N >> M;
  for (i = 1; i <= N; ++i) cin >> val[i];
  for (i = 1; i <= M; ++i) {
    cin >> cod;
    if (cod == 1) {
      cin >> index >> x;
      val[index] = x;
      add[index] = sup;
    }
    if (cod == 2) {
      cin >> x;
      sup += x;
    }
    if (cod == 3) {
      cin >> index;
      cout << (val[index] + sup - add[index]) << '\n';
    }
  }
  return 0;
}
