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