#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, a[N], b[N], r[N], q;
void readInput() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
}
int get_r(int x) { return r[x] >= 0 ? r[x] = get_r(r[x]) : x; }
void fill(int p, int x) {
  while (x) {
    int z = get_r(p);
    if (a[z] == b[z]) {
      return;
    } else {
      int y = a[z] - b[z];
      b[z] += min(x, y);
      x -= min(x, y);
      if (a[z] == b[z] && z != n - 1) {
        r[z] = get_r(z + 1);
      }
      if (r[z] == -1) return;
      p = r[z];
    }
  }
}
void solve() {
  memset(r, -1, sizeof r);
  cin >> q;
  while (q--) {
    int ch, p, x;
    cin >> ch;
    if (ch & 1) {
      cin >> p >> x;
      fill(--p, x);
    } else {
      cin >> p;
      cout << b[--p] << endl;
    }
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  readInput(), solve();
  return 0;
}
