#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, x;
  cin >> n >> m;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  int a, b, c;
  long long sum = 0;
  while (m--) {
    cin >> a;
    if (a == 1) {
      cin >> b >> c;
      v[b - 1] = c - sum;
    } else {
      cin >> b;
      if (a == 2) {
        sum += b;
      } else {
        cout << v[b - 1] + sum << "\n";
      }
    }
  }
}
