#include <bits/stdc++.h>
using namespace std;
long long int n, m;
void solve() {
  cin >> n;
  cin >> m;
  vector<long long int> v;
  v.reserve(n + 1);
  long long int x;
  for (long long int i = 1; i <= n; i++) {
    cin >> x;
    v[i] = x;
  }
  long long int sum = 0;
  while (m--) {
    long long int t;
    cin >> t;
    if (t == 1) {
      long long int index, in;
      cin >> index >> in;
      v[index] = in - sum;
    } else if (t == 2) {
      long long int y;
      cin >> y;
      sum += y;
    } else if (t == 3) {
      long long int q;
      cin >> q;
      cout << v[q] + sum << "\n";
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
