#include <bits/stdc++.h>
using namespace std;
int sz[210000];
struct UnionFind {
  vector<int> parent, a;
  UnionFind(int n) {
    parent = vector<int>(n);
    a = vector<int>(n);
    for (int i = 0; i < n; i++) {
      parent[i] = i;
      a[i] = 0;
    }
  }
  int find_set(int node) {
    if (parent[node] == node) return node;
    return parent[node] = find_set(parent[node]);
  }
  void link(int node1, int node2) {
    if (node2 == parent.size()) return;
    parent[node1] = find_set(node2);
  }
  void pour(int node, int first) {
    if (node == parent.size()) return;
    int leader = find_set(node);
    if (first + a[leader] > sz[leader]) {
      int rem = sz[leader] - a[leader];
      link(leader, leader + 1);
      pour(leader + 1, first - rem);
      a[leader] = sz[leader];
    } else {
      a[leader] += first;
    }
  }
  int get_water(int node) { return a[node]; }
};
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> sz[i];
  UnionFind uf(n);
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int kind;
    cin >> kind;
    if (kind == 1) {
      int node, first;
      cin >> node >> first;
      uf.pour(node - 1, first);
    } else {
      int node;
      cin >> node;
      cout << uf.get_water(node - 1) << '\n';
    }
  }
}
