#include <bits/stdc++.h>
using namespace std;
const long long maxN = 1e5 + 7, MOD = 1e9 + 7, inf = 1e9, N = 30;
long long n, k, a[maxN], c[maxN], d[maxN], x, y, v, m;
int main() {
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) cin >> a[i], c[i] = 1;
  for (long long i = 1; i <= m; i++) {
    cin >> x;
    d[i] = d[i - 1];
    if (x == 1) cin >> v >> y, a[v] = y, c[v] = i;
    if (x == 2) cin >> y, d[i] += y;
    if (x == 3) cin >> y, cout << d[i] - d[c[y] - 1] + a[y] << "\n";
  }
  return cout << "\n", 0;
}
