#include <bits/stdc++.h>
using namespace std;
long long n, m, i, t, x, y, cnt, a[100005], b[100005], s[100005];
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= m; i++) {
    cin >> t;
    if (t == 1) {
      cin >> x >> y;
      a[x] = y;
      b[x] = cnt;
    } else if (t == 2) {
      cin >> x;
      cnt++;
      s[cnt] = x + s[cnt - 1];
    } else {
      cin >> x;
      cout << a[x] + s[cnt] - s[b[x]] << '\n';
    }
  }
  return 0;
}
