#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  long long ar[n];
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  long long sum = 0;
  for (int i = 0; i < m; i++) {
    int t;
    cin >> t;
    long long x, y;
    if (t == 1) {
      cin >> x >> y;
      ar[x - 1] = y - sum;
    } else if (t == 2) {
      cin >> x;
      sum += x;
    } else {
      cin >> x;
      cout << ar[x - 1] + sum << "\n";
    }
  }
  return 0;
}
