#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
int a[MAXN], c[MAXN], p[MAXN];
int main() {
  int i, j, N, M, op, poz, Val, l, r;
  cin >> N;
  for (i = 1; i <= N; ++i) {
    cin >> a[i];
    p[i] = i;
  }
  cin >> M;
  while (M--) {
    cin >> op;
    if (op == 1) {
      cin >> poz >> Val;
      l = p[poz];
      while (c[l] + Val >= a[l] && l <= N) {
        Val -= (a[l] - c[l]);
        c[l] = a[l];
        ++l;
      }
      if (l <= N) c[l] += Val;
      for (j = p[poz]; j < l; ++j) p[j] = l;
      p[poz] = l;
    } else {
      cin >> poz;
      cout << c[poz] << '\n';
    }
  }
  return 0;
}
