#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
struct DSU {
  int connected;
  vector<long long int> node_par, node_size;
  DSU(int n) {
    node_size.resize(n);
    node_par.resize(n);
    for (int i = 1; i <= n; i++) node_par[i] = i, node_size[i] = 1;
    connected = n;
  }
  int getPar(int node) {
    while (node_par[node] != node) {
      node_par[node] = node_par[node_par[node]];
      node = node_par[node];
    }
    return node;
  }
  int getSize(int node) { return node_size[getPar(node)]; }
  void unite(int a, int b) {
    int par1 = getPar(a), par2 = getPar(b);
    if (par1 == par2) return;
    connected--;
    if (node_size[par1] > node_size[par2]) swap(par1, par2);
    node_size[par2] += node_size[par1];
    node_size[par1] = 0;
    node_size[par2] += node_size[par1];
    node_size[par1] = 1;
    node_par[par1] = node_par[par2];
  }
};
int n, q;
DSU new_to_go(200010);
long long int end_point[200010];
long long int actual_water[200010], remmaing_water[200010];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  clock_t clk = clock();
  cin >> n;
  for (int i = 1; i <= n; i++)
    cin >> remmaing_water[i], actual_water[i] = remmaing_water[i];
  actual_water[n + 1] = remmaing_water[n + 1] = 1e15;
  for (int i = 1; i <= n + 1; i++) end_point[i] = i;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int type;
    cin >> type;
    if (type == 1) {
      int ves, water;
      cin >> ves >> water;
      int par = new_to_go.getPar(ves);
      int curr_vess = end_point[par];
      while (water != 0) {
        if (remmaing_water[curr_vess] > water) {
          remmaing_water[curr_vess] -= water;
          water = 0;
        } else {
          water -= remmaing_water[curr_vess];
          remmaing_water[curr_vess] = 0;
          end_point[new_to_go.getPar(curr_vess)] =
              end_point[new_to_go.getPar(curr_vess + 1)];
          new_to_go.unite(curr_vess, curr_vess + 1);
          par = new_to_go.getPar(curr_vess + 1);
          curr_vess = end_point[par];
        }
      }
    } else {
      int ves;
      cin >> ves;
      cout << actual_water[ves] - remmaing_water[ves] << endl;
    }
  }
  cerr << endl
       << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;
  return 0;
}
