#include <bits/stdc++.h>
using namespace std;
int n, m, j, s;
int k[100000], a[100000], b[100000];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> k[i];
  for (int i = 0; i < m; i++) {
    int x, y, z;
    cin >> x >> y;
    if (x == 1) {
      cin >> z;
      k[y - 1] = z;
      a[y - 1] = s;
    }
    if (x == 2) s += y;
    if (x == 3) {
      b[j] = k[y - 1] + s - a[y - 1];
      j++;
    }
  }
  for (int i = 0; i < j; i++) cout << b[i] << endl;
}
