#include <bits/stdc++.h>
const long long int maxc = 10005;
const long long int mod = 1000000000;
using namespace std;
bool cmp(pair<long long int, long long int> a,
         pair<long long int, long long int> b) {
  return a.first > b.first;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void solve() {
  long long int n, m, i, j, k, x, y, e, t, T, ans, cnt, mn, sum, mx, f;
  bool flag;
  t = 1;
  while (t--) {
    cin >> n >> m;
    long long int a[100005], pos = 0, sum = 0;
    for (long long int i = 0; i < n; i++) cin >> a[i];
    while (m--) {
      cin >> k;
      if (k == 1) {
        cin >> pos >> x;
        a[pos - 1] = x - sum;
      } else if (k == 2) {
        cin >> x;
        sum += x;
      } else {
        cin >> x;
        cout << a[x - 1] + sum << "\n";
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
