#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%i %i", &n, &m);
  int array[n];
  for (int i = 0; i < n; i++) {
    scanf("%i", &array[i]);
  }
  int counter = 0;
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%i %i", &a, &b);
    if (a == 1) {
      int x;
      cin >> x;
      array[b - 1] = x - counter;
    }
    if (a == 2) {
      counter += b;
    }
    if (a == 3) {
      cout << array[b - 1] + counter << endl;
    }
  }
}
