#include <bits/stdc++.h>
using namespace std;
long long bigmod(long long a, long long m) {
  long long ret = 1;
  while (m) {
    if (m & 1) ret = ret * a % 1000007;
    m >>= 1;
    a = (a * a) % 1000007;
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  long n, m, k, c, i;
  while (cin >> n >> m) {
    long a[100009] = {0}, p, x, y, s = 0;
    for (i = 1; i <= n; i++) cin >> a[i];
    for (i = 1; i <= m; i++) {
      cin >> p;
      if (p == 3) {
        cin >> x;
        cout << a[x] + s << endl;
      } else if (p == 2) {
        cin >> y;
        s = s + y;
      } else if (p == 1) {
        cin >> x >> y;
        a[x] = y - s;
      }
    }
  }
  return 0;
}
