#include <bits/stdc++.h>
using namespace std;
long long n, cap[300000], pre[300000], nxt[300000], tests, ins[300000];
long long tp, q, a, b;
long long cput;
set<long long> fre;
set<long long>::iterator it;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> cap[i];
  for (int i = 1; i <= n + 1; i++) fre.insert(i);
  cap[n + 1] = 1e18;
  for (int i = 1; i <= n; i++) {
    pre[i] = i - 1;
    nxt[i] = i + 1;
  }
  cin >> tests;
  for (; tests; --tests) {
    cin >> tp;
    if (tp == 2) {
      cin >> q;
      cout << ins[q] << endl;
    } else {
      cin >> a >> b;
      it = fre.lower_bound(a);
      a = (*it);
      while (b > 0) {
        cput = min(b, cap[a] - ins[a]);
        b -= cput;
        ins[a] += cput;
        if (ins[a] == cap[a]) {
          nxt[pre[a]] = nxt[a];
          pre[nxt[a]] = pre[a];
          fre.erase(a);
          a = nxt[a];
        }
      }
    }
  }
  cin.get();
  cin.get();
  return 0;
}
