#include <bits/stdc++.h>
using namespace std;
int cap[200002];
int amt[200002];
int nex[200002];
int get_next(int vessel) {
  if (cap[vessel] > amt[vessel]) {
    return vessel;
  } else {
    return nex[vessel] = get_next(nex[vessel]);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> cap[i];
    amt[i] = 0;
    nex[i] = i + 1;
  }
  cap[n + 1] = 1;
  amt[n + 1] = 0;
  nex[n + 1] = n + 1;
  int m;
  cin >> m;
  while (m--) {
    int q, vessel, water;
    cin >> q;
    if (q == 1) {
      cin >> vessel >> water;
      while (water > 0 && vessel <= n) {
        int to_pour = min(water, cap[vessel] - amt[vessel]);
        amt[vessel] += to_pour;
        water -= to_pour;
        vessel = get_next(vessel);
      }
    } else {
      cin >> vessel;
      cout << amt[vessel] << endl;
    }
  }
  return 0;
}
