#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
long long a[N];
long long p[N];
long long size[N];
long long n;
long long root(long long v) {
  if (v != p[v]) {
    return p[v] = root(p[v]);
  }
  return v;
}
void fix(long long v, long long x) {
  if (v == n + 1) return;
  p[v] = v + 1;
  long long r = root(p[v]);
  p[v] = r;
  if (size[r] + x <= a[r]) {
    size[r] += x;
    return;
  } else {
    long long excess = size[r] + x - a[r];
    size[r] = a[r];
    fix(r, excess);
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    p[i] = i;
    size[i] = 0;
  }
  p[n + 1] = n + 1;
  long long q;
  cin >> q;
  while (q--) {
    long long type, x, k;
    cin >> type;
    if (type == 1) {
      cin >> k >> x;
      if (size[k] + x <= a[k]) {
        size[k] += x;
      } else {
        long long excess = size[k] + x - a[k];
        size[k] = a[k];
        if (k == n) continue;
        fix(k, excess);
      }
    } else {
      cin >> k;
      cout << size[k] << '\n';
    }
  }
}
