#include <bits/stdc++.h>
using namespace std;
const double PI = 3.1415926535897932384626433832795;
const long long INF = 1e18 + 7;
const double EPS = 1 / 1e9;
const long long MOD = 1000000007;
using namespace std;
string s;
long long n;
long long ans = 0;
void solve() {
  int n;
  vector<long long> a, b;
  a.push_back(0);
  int m, x, k, y;
  long long sum = 0, t = 0;
  cin >> n >> m;
  b.assign(n + 1, 0);
  for (int i = 0; i < n; i++) {
    cin >> x;
    a.push_back(x);
  }
  while (m--) {
    cin >> k;
    if (k == 1) {
      cin >> x >> y;
      a[x] = y - sum;
    } else if (k == 2) {
      cin >> x;
      sum += x;
    } else {
      cin >> x;
      cout << a[x] + sum << endl;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int k1 = 1;
  while (k1--) solve();
  return 0;
}
