#include <bits/stdc++.h>
using namespace std;
template <class T, class S>
inline bool CMX(T &a, S b) {
  return a < b ? a = b, true : false;
}
template <class T, class S>
inline bool CMN(T &a, S b) {
  return a > b ? a = b, true : false;
}
template <typename T>
inline void rd(T &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
const int N = 2e5 + 5;
int n, m;
long long tr[N << 2], tag[N << 2], a[N];
inline void pushup(int o) { tr[o] = tr[o * 2] + tr[o * 2 + 1]; }
inline void pushdown(int o, int Len) {
  if (tag[o] != -1) {
    long long x = tag[o];
    tag[o * 2] = tag[o * 2 + 1] = x;
    tr[o * 2] = x * (Len - (Len >> 1));
    tr[o * 2 + 1] = x * (Len >> 1);
    tag[o] = -1;
  }
}
void bd(int o, int l, int r) {
  tag[o] = -1;
  if (l == r) {
    tr[o] = a[l];
    return;
  }
  bd(o * 2, l, (l + r) / 2);
  bd(o * 2 + 1, (l + r) / 2 + 1, r);
  pushup(o);
}
void up1(int o, int l, int r, int p, long long x) {
  if (l == r) {
    tr[o] = x;
    return;
  }
  pushdown(o, r - l + 1);
  if (p <= (l + r) / 2) up1(o * 2, l, (l + r) / 2, p, x);
  if (p > (l + r) / 2) up1(o * 2 + 1, (l + r) / 2 + 1, r, p, x);
  pushup(o);
}
void up2(int o, int l, int r, int ql, int qr, long long x) {
  if (qr < l || ql > r) return;
  if (ql <= l && r <= qr) {
    tag[o] = x;
    tr[o] = x * (r - l + 1);
    return;
  }
  pushdown(o, r - l + 1);
  if (ql <= (l + r) / 2) up2(o * 2, l, (l + r) / 2, ql, qr, x);
  if (qr > (l + r) / 2) up2(o * 2 + 1, (l + r) / 2 + 1, r, ql, qr, x);
  pushup(o);
}
long long qu(int o, int l, int r, int ql, int qr) {
  if (qr < l || ql > r) return 0;
  if (ql <= l && r <= qr) return tr[o];
  pushdown(o, r - l + 1);
  long long ans = 0;
  if (ql <= (l + r) / 2) ans += qu(o * 2, l, (l + r) / 2, ql, qr);
  if (qr > (l + r) / 2) ans += qu(o * 2 + 1, (l + r) / 2 + 1, r, ql, qr);
  return ans;
}
int lc;
void qu1(int o, int l, int r, long long x) {
  if (l == r) {
    lc = l;
    return;
  }
  pushdown(o, r - l + 1);
  if (tr[o * 2] >= x)
    qu1(o * 2, l, (l + r) / 2, x);
  else if (tr[o * 2 + 1] >= (x - tr[o * 2]))
    qu1(o * 2 + 1, (l + r) / 2 + 1, r, x - tr[o * 2]);
}
long long quu(int o, int l, int r, int ps) {
  if (l == r) return tr[o];
  pushdown(o, r - l + 1);
  if (ps <= (l + r) / 2) return quu(o * 2, l, (l + r) / 2, ps);
  if (ps > (l + r) / 2) return quu(o * 2 + 1, (l + r) / 2 + 1, r, ps);
}
int main() {
  rd(n);
  for (int i = 1; i <= n; i++) rd(a[i]);
  bd(1, 1, n);
  rd(m);
  while (m--) {
    int opt, p;
    long long x;
    rd(opt);
    if (opt == 1) {
      rd(p);
      rd(x);
      lc = -1;
      long long ans = 0;
      if (p > 1) ans = qu(1, 1, n, 1, p - 1);
      qu1(1, 1, n, ans + x);
      if (lc == -1) {
        up2(1, 1, n, p, n, 0);
      } else {
        if (p == lc) {
          long long tmp = quu(1, 1, n, p);
          tmp -= x;
          CMX(tmp, 0);
          up1(1, 1, n, p, tmp);
        } else {
          long long pre = qu(1, 1, n, 1, lc - 1);
          long long tmp = ans + x - pre;
          long long c = quu(1, 1, n, lc);
          c -= tmp;
          CMX(c, 0);
          up1(1, 1, n, lc, c);
          up2(1, 1, n, p, lc - 1, 0);
        }
      }
    } else {
      rd(p);
      long long tmp = quu(1, 1, n, p);
      printf("%lld\n", a[p] - tmp);
    }
  }
}
