#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int BIG = 1e9 + 555;
const int maxN = 200 * 1000 + 9;
int n, q;
long long segTree[maxN * 4], lazy[maxN * 4], a[maxN];
void propagate(int id, int l, int r) {
  if (lazy[id] > -1) {
    segTree[id] = (r - l + 1) * lazy[id];
    if (l != r) {
      lazy[id * 2] = lazy[id];
      lazy[id * 2 + 1] = lazy[id];
    }
  }
  lazy[id] = -1;
}
void upd(int id, int l, int r, int L, int R, long long val) {
  propagate(id, l, r);
  if (L <= l && r <= R) {
    lazy[id] = val;
    propagate(id, l, r);
    return;
  }
  if (r < L || l > R) {
    return;
  }
  int mid = (l + r) / 2;
  upd(id * 2, l, mid, L, R, val);
  upd(id * 2 + 1, mid + 1, r, L, R, val);
  segTree[id] = segTree[id * 2] + segTree[id * 2 + 1];
}
void upd(int l, int r, long long val) { upd(1, 1, n, l, r, val); }
long long sum(int id, int l, int r, int L, int R) {
  propagate(id, l, r);
  if (L <= l && r <= R) {
    return segTree[id];
  }
  if (r < L || l > R) {
    return 0;
  }
  int mid = (l + r) / 2;
  return sum(id * 2, l, mid, L, R) + sum(id * 2 + 1, mid + 1, r, L, R);
}
long long sum(int l, int r) { return sum(1, 1, n, l, r); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  fill_n(lazy + 1, 4 * n, -1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    upd(i, i, a[i]);
  }
  cin >> q;
  while (q--) {
    int tp;
    cin >> tp;
    if (tp == 1) {
      int p;
      long long x;
      cin >> p >> x;
      int lo = p, hi = n, ans = n;
      if (sum(p, n) < x) {
        upd(p, n, 0);
        continue;
      }
      while (lo <= hi) {
        int mid = (lo + hi) / 2;
        if (x <= sum(p, mid)) {
          ans = mid;
          hi = mid - 1;
        } else {
          lo = mid + 1;
        }
      }
      long long rem = sum(p, ans) - x;
      if (p <= ans - 1) {
        upd(p, ans - 1, 0);
      }
      upd(ans, ans, rem);
    } else {
      int p;
      cin >> p;
      cout << a[p] - sum(p, p) << '\n';
    }
  }
  return 0;
}
