#include <bits/stdc++.h>
using namespace std;
inline int rdi() {
  int d;
  scanf("%d", &d);
  return d;
}
inline char rdc() {
  scanf(" ");
  return getchar();
}
inline string rds() {
  string s;
  cin >> s;
  return s;
}
inline double rddb() {
  double d;
  scanf("%lf", &d);
  return d;
}
template <class T>
inline bool updateMin(T& a, T b) {
  return a > b ? a = b, true : false;
}
template <class T>
inline bool updateMax(T& a, T b) {
  return a < b ? a = b, true : false;
}
int lowbit[100000 + 1], c[100000 + 1], sum[100000 + 1];
int a[100000 + 1];
inline void add(int i, int d) {
  while (i <= 100000) c[i] += d, i += lowbit[i];
}
inline int getsum(int x) {
  int result = 0;
  while (x > 0) {
    result += c[x];
    x -= lowbit[x];
  }
  return result;
}
void Modify(int i, int n, int delta) {
  a[i] += delta;
  for (int x = i; x <= n; x += lowbit[x]) c[x] += delta;
}
int d = 0;
int main() {
  int n = rdi(), m = rdi();
  for (int i = (1); i <= (n); ++i) a[i] = rdi();
  for (int i = (0); i < (m); ++i) {
    int k = rdi();
    int p, c, j, x;
    switch (k) {
      case 1:
        p = rdi();
        x = rdi();
        a[p] = x - d;
        break;
      case 2:
        c = rdi();
        d = d + c;
        break;
      case 3:
        j = rdi();
        cout << a[j] + d << endl;
        break;
      default:;
    }
  }
  return 0;
}
