#include <bits/stdc++.h>
using namespace std;
long long n, m, vet[202020], cap[202020];
set<long long> s;
int main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) scanf("%lld", &cap[i]), s.insert(i);
  scanf("%lld", &m);
  long long op, x, p, k;
  while (m--) {
    scanf("%lld", &op);
    if (op == 1) {
      scanf("%lld %lld", &p, &x);
      for (auto it = s.lower_bound(p); it != s.end() && x; it = s.erase(it)) {
        long long id = *it;
        if (cap[id] - vet[id] > x) {
          vet[id] += x;
          break;
        }
        x -= cap[id] - vet[id];
        vet[id] = cap[id];
      }
    } else {
      scanf("%lld", &k);
      printf("%lld\n", vet[k]);
    }
  }
}
