#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const long long inf = 1e18;
int par[maxn];
long long cap[maxn], a[maxn];
int root(int v) {
  if (par[v] == v) return v;
  return par[v] = root(par[v]);
}
void add(int v, long long x) {
  int y = min(x, cap[v] - a[v]);
  a[v] += y;
  if (a[v] == cap[v]) par[v] = par[v + 1];
  if (y != x) {
    add(root(v), x - y);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    par[i] = i;
    cin >> cap[i];
  }
  cap[n] = inf;
  par[n] = n;
  int q;
  cin >> q;
  while (q--) {
    int type;
    cin >> type;
    if (type == 1) {
      int x, p;
      cin >> p >> x;
      p--;
      add(p, x);
    } else {
      int k;
      cin >> k;
      k--;
      cout << a[k] << '\n';
    }
  }
}
