#include <bits/stdc++.h>
using namespace std;
long long A[(int)1e5 + 10], cum;
int main() {
  int n, m, c, x, y;
  cin >> n >> m;
  for (int i = 1; i < n + 1; ++i) cin >> A[i];
  while (m--) {
    cin >> c >> x;
    if (c == 1) cin >> y, A[x] = y - cum;
    if (c == 2) cum += x;
    if (c == 3) cout << A[x] + cum << endl;
  }
  return 0;
}
