#include <bits/stdc++.h>
const long long int M = 1000000007;
const double pi = 3.1415926;
using namespace std;
void fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  fastio();
  int n, m;
  cin >> n >> m;
  vector<long long int> v(n);
  for (long long int &x : v) {
    cin >> x;
  }
  long long int sum = 0;
  for (int j = 0; j < m; j++) {
    long long int x;
    cin >> x;
    if (x == 1) {
      long long int y, z;
      cin >> y >> z;
      v[y - 1] = z - sum;
    } else if (x == 2) {
      long long int y;
      cin >> y;
      sum += y;
    } else {
      long long int y;
      cin >> y;
      cout << v[y - 1] + sum;
      cout << "\n";
    }
  }
  return 0;
}
