#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 * 100 + 1000;
long long a[maxn], n, m, sum;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      int x, y;
      cin >> x >> y;
      a[x] = y - sum;
    }
    if (t == 2) {
      int y;
      cin >> y;
      sum += y;
    }
    if (t == 3) {
      int q;
      cin >> q;
      cout << a[q] + sum << endl;
    }
  }
  return 0;
}
