#include <bits/stdc++.h>
using namespace std;
long long findpar(long long n, long long *cap, long long *capfil,
                  long long *parent, long long p) {
  if ((cap[parent[p]] - capfil[parent[p]]) > 0) return parent[p];
  if (p == n - 1) return n - 1;
  long long superparent = findpar(n, cap, capfil, parent, parent[p]);
  parent[p] = superparent;
  return superparent;
}
void filves(long long n, long long *cap, long long *capfil, long long *parent,
            long long p, long long x) {
  if (p != n) {
    if ((capfil[p - 1] + x) <= cap[p - 1]) {
      capfil[p - 1] = capfil[p - 1] + x;
      return;
    }
    x = x - (cap[p - 1] - capfil[p - 1]);
    capfil[p - 1] = cap[p - 1];
    long long par = findpar(n, cap, capfil, parent, p - 1);
    filves(n, cap, capfil, parent, (par + 1), x);
  } else if (p == n) {
    if ((capfil[n - 1] + x) <= cap[n - 1]) {
      capfil[n - 1] = capfil[n - 1] + x;
      return;
    }
    capfil[n - 1] = cap[n - 1];
  } else
    return;
}
int main() {
  long long n;
  cin >> n;
  long long cap[n], parent[n], capfil[n];
  long long i;
  for (i = 0; i < n; i++) cin >> cap[i];
  memset(capfil, 0, sizeof(capfil));
  for (i = 0; i < n - 1; i++) parent[i] = i + 1;
  parent[n - 1] = n - 1;
  long long t;
  cin >> t;
  while (t--) {
    int c;
    cin >> c;
    if (c == 2) {
      long long k;
      cin >> k;
      cout << capfil[k - 1] << "\n";
    } else {
      long long p, x;
      cin >> p >> x;
      filves(n, cap, capfil, parent, p, x);
    }
  }
}
