#include <bits/stdc++.h>
using namespace std;
int capacity[200005];
int filled[200005];
int root[200005];
void initialize(int n) {
  for (int i = 1; i <= n; i++) {
    root[i] = i;
  }
}
void mergeTwo(int u, int v) { root[u] = root[v]; }
int findRoot(int u) {
  while (u != root[u]) {
    root[u] = root[root[u]];
    u = root[u];
  }
  return u;
}
int main() {
  int n, m, i, j, d, type, p, x, k, temp;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> capacity[i];
  }
  cin >> m;
  initialize(n + 1);
  while (m--) {
    cin >> type;
    if (type == 1) {
      cin >> p >> x;
      p = findRoot(p);
      while (p != n + 1) {
        temp = min(capacity[p] - filled[p], x);
        x -= temp;
        filled[p] += temp;
        if (capacity[p] == filled[p]) {
          mergeTwo(p, findRoot(p + 1));
          p = findRoot(p + 1);
        } else {
          break;
        }
      }
    } else {
      cin >> k;
      cout << filled[k] << "\n";
    }
  }
  return 0;
}
