#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long int LINF = 0x3f3f3f3f3f3f3f3fll;
const long double pi = acos(-1);
const int MOD = 1e9 + 7;
int main() {
  long long int n, m, i, soma, op, num, index;
  scanf("%lld%lld", &n, &m);
  vector<long long int> vetor(n);
  map<int, long long int> minus;
  soma = 0;
  for (i = 0; i < n; i++) {
    scanf("%lld", &vetor[i]);
  }
  for (i = 0; i < m; i++) {
    scanf("%lld", &op);
    if (op == 1) {
      scanf("%lld%lld", &index, &num);
      index--;
      vetor[index] = num;
      minus[index] = soma;
    } else if (op == 2) {
      scanf("%lld", &num);
      soma += num;
    } else {
      scanf("%lld", &index);
      index--;
      printf("%lld\n", soma + vetor[index] - minus[index]);
    }
  }
  return 0;
}
