#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 6;
const int T = 3e6 + 6;
int d;
int un = -1;
long long t[T], ts[T];
void upd(int i, int j, long long x, int l = 0, int r = d - 1, int v = 1) {
  if (i == l && j == r) {
    ts[v] = x;
    t[v] = x * (r - l + 1);
    return;
  }
  int m = (l + r) >> 1;
  if (ts[v] != un) {
    ts[v * 2] = ts[v * 2 + 1] = ts[v];
    t[v * 2] = t[v * 2 + 1] = ts[v] * (r - m);
    ts[v] = un;
  }
  if (i <= m) upd(i, min(j, m), x, l, m, v * 2);
  if (j > m) upd(max(i, m + 1), j, x, m + 1, r, v * 2 + 1);
  t[v] = t[v * 2] + t[v * 2 + 1];
}
long long rsq(int i, int j, int l = 0, int r = d - 1, int v = 1) {
  if (i == l && j == r) return t[v];
  int m = (l + r) >> 1;
  if (ts[v] != un) return ts[v] * (j - i + 1);
  long long s = 0;
  if (i <= m) s += rsq(i, min(j, m), l, m, v * 2);
  if (j > m) s += rsq(max(i, m + 1), j, m + 1, r, v * 2 + 1);
  return s;
}
int a[N];
int main() {
  int n, m;
  scanf("%d", &n);
  for (d = 1; d <= n; d <<= 1)
    ;
  for (int i = 1; i < d * 2; ++i) ts[i] = un;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    upd(i, i, a[i]);
  }
  upd(n, n, 1e18);
  scanf("%d", &m);
  while (m--) {
    int tp;
    scanf("%d", &tp);
    if (tp == 2) {
      int i;
      scanf("%d", &i);
      --i;
      cout << a[i] - rsq(i, i) << endl;
    } else {
      int i, x;
      scanf("%d%d", &i, &x);
      --i;
      int l = i, r = n + 1;
      long long s;
      while (l < r) {
        int m = (l + r) >> 1;
        s = rsq(i, m);
        if (s >= x)
          r = m;
        else
          l = m + 1;
      }
      s = rsq(i, r);
      if (i <= r - 1) upd(i, r - 1, 0);
      if (r < n) upd(r, r, (s - x));
    }
  }
  return 0;
}
