#include <bits/stdc++.h>
using namespace std;
long long a[100005], ac[100005];
int last[100005];
int main() {
  int n, m, t, x, v, y, q;
  string s;
  while (cin >> n >> m) {
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= m; i++) {
      cin >> t;
      if (t == 1) {
        cin >> v >> x;
        a[v] = x;
        last[v] = i;
        ac[i] = ac[i - 1];
      } else {
        if (t == 2) {
          cin >> y;
          ac[i] = ac[i - 1] + y;
        } else {
          cin >> q;
          cout << a[q] + ac[i - 1] - ac[last[q]] << endl;
          ac[i] = ac[i - 1];
        }
      }
    }
  }
}
