#include <bits/stdc++.h>
using namespace std;
long long a[100100];
int main() {
  long long n, m, i, d, l, k, sum = 0;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    scanf("%I64d", &a[i]);
  }
  while (m--) {
    cin >> d >> l;
    if (d == 3) {
      cout << a[l - 1] + sum << endl;
    } else if (d == 2)
      sum += l;
    else if (d == 1) {
      cin >> k;
      a[l - 1] = 0;
      a[l - 1] -= sum;
      a[l - 1] += k;
    }
  }
  return 0;
}
