#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, a[N], ls[N << 2], rs[N << 2];
long long w[N << 2];
bool add[N << 2];
void build(int p, int l, int r) {
  ls[p] = l, rs[p] = r;
  if (l == r) {
    w[p] = a[l];
    return;
  }
  int mid = l + r >> 1;
  build(p << 1, l, mid);
  build(p << 1 | 1, mid + 1, r);
  w[p] = w[p << 1] + w[p << 1 | 1];
}
void push_down(int p) {
  if (add[p]) {
    w[p << 1] = 0;
    w[p << 1 | 1] = 0;
    add[p << 1] = true, add[p << 1 | 1] = true;
    add[p] = false;
  }
}
void update(int p, int l, int r, int v) {
  if (ls[p] >= l && rs[p] <= r) {
    w[p] = 0;
    add[p] = true;
    return;
  }
  push_down(p);
  int mid = ls[p] + rs[p] >> 1;
  if (l <= mid) update(p << 1, l, r, v);
  if (r > mid) update(p << 1 | 1, l, r, v);
  w[p] = w[p << 1] + w[p << 1 | 1];
}
void update(int p, int x, int v) {
  if (ls[p] == rs[p]) {
    w[p] += v;
    return;
  }
  push_down(p);
  int mid = ls[p] + rs[p] >> 1;
  if (x <= mid)
    update(p << 1, x, v);
  else
    update(p << 1 | 1, x, v);
  w[p] = w[p << 1] + w[p << 1 | 1];
}
long long query(int p, int l, int r) {
  if (l > r) return 0;
  if (ls[p] >= l && rs[p] <= r) return w[p];
  push_down(p);
  int mid = ls[p] + rs[p] >> 1;
  if (r <= mid) return query(p << 1, l, r);
  if (l > mid) return query(p << 1 | 1, l, r);
  return query(p << 1, l, r) + query(p << 1 | 1, l, r);
}
int query(int p, int l, int r, long long v) {
  if (l == r) {
    if (w[p] > v) return -1;
    return l;
  }
  push_down(p);
  int mid = ls[p] + rs[p] >> 1;
  if (w[p << 1] <= v)
    return max(mid, query(p << 1 | 1, mid + 1, r, v - w[p << 1]));
  return query(p << 1, l, mid, v);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  ++n;
  for (int i = 2; i <= n; i++) {
    cin >> a[i];
  }
  build(1, 1, n);
  int q;
  cin >> q;
  for (int i = 1; i <= q; i++) {
    int o;
    cin >> o;
    if (o == 1) {
      int x, v;
      cin >> x >> v;
      ++x;
      int pos = query(1, 1, n, query(1, 1, x - 1) + v);
      long long sum = query(1, x, pos);
      if (sum) update(1, x, pos, 0);
      if (sum < v && pos != n) update(1, pos + 1, -(v - sum));
    } else {
      int x;
      cin >> x;
      ++x;
      cout << a[x] - query(1, x, x) << '\n';
    }
  }
  return 0;
}
