#include <bits/stdc++.h>
using namespace std;
long long a[100005], i, b, n, m, vi, xi, qi, j, c, d, sum;
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (i = 1; i <= m; i++) {
    cin >> b;
    if (b == 1) {
      cin >> vi >> xi;
      a[vi] = xi - sum;
    }
    if (b == 2) {
      cin >> c;
      sum = sum + c;
    }
    if (b == 3) {
      cin >> d;
      cout << a[d] + sum << endl;
    }
  }
}
