#include <bits/stdc++.h>
using namespace std;
const int N = 2e5;
int n, Nxt, siz[N + 10], emp[N + 10], nxt[N + 10];
void dsu(int ves, int val) {
  if (val < emp[ves]) {
    emp[ves] -= val, Nxt = ves;
    return;
  } else if (ves == n) {
    Nxt = n;
    return;
  }
  val -= emp[ves], emp[ves] = 0;
  dsu(nxt[ves], val);
  nxt[ves] = Nxt;
  return;
}
int main() {
  int q;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> siz[i], emp[i] = siz[i], nxt[i] = i + 1;
  cin >> q;
  while (q--) {
    int t, ves, val;
    cin >> t >> ves, ves--;
    if (t == 1)
      cin >> val, dsu(ves, val);
    else
      cout << siz[ves] - emp[ves] << endl;
  }
  return 0;
}
