#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
struct duo {
  long long x, y;
};
bool mycomp(duo a, duo b) { return a.x < b.x; }
bool comp(int a, int b) { return a < b; }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t, n, b = 0, d, m, i, j, k, c, sum = 0;
  cin >> n >> m;
  long long a[n];
  vector<pair<int, int>> v(100001);
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < m; i++) {
    cin >> b >> c;
    if (b == 1) {
      cin >> d;
      v[c].first = d;
      v[c].second = sum;
      a[c - 1] = d;
    } else if (b == 2) {
      sum += c;
    } else {
      cout << a[c - 1] + sum - v[c].second << "\n";
    }
  }
}
