#include <bits/stdc++.h>
using namespace std;
vector<long long> P;
long long sum = 0;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    long long t;
    cin >> t;
    P.push_back(t);
  }
  for (int i = 0; i < m; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      long long v, u;
      cin >> v >> u;
      v--;
      P[v] = u - sum;
    } else if (t == 2) {
      int v;
      cin >> v;
      sum += v;
    } else {
      int v;
      cin >> v;
      v--;
      cout << P[v] + sum << endl;
    }
  }
  return 0;
}
