#include <bits/stdc++.h>
using namespace std;
int main() {
  long c = 0;
  cin >> c;
  set<long> st;
  pair<long, long> *pr_arr = new pair<long, long>[c];
  for (long i = 0; i < c; i++) {
    cin >> pr_arr[i].first;
    pr_arr[i].second = 0;
    st.insert(i);
  }
  cin >> c;
  for (long i = 0; i < c; i++) {
    int action = 0;
    long index = 0;
    long lit = 0;
    cin >> action;
    cin >> index;
    index--;
    if (action == 1) {
      cin >> lit;
      while (lit != 0) {
        set<long>::iterator temp;
        temp = st.lower_bound(index);
        if (temp == st.end()) break;
        index = *temp;
        long real_cap = pr_arr[index].first - pr_arr[index].second;
        if (real_cap == 0) break;
        if (lit > real_cap) {
          pr_arr[index].second += real_cap;
          lit -= real_cap;
        } else {
          pr_arr[index].second += lit;
          lit = 0;
        }
        if (pr_arr[index].first == pr_arr[index].second) st.erase(index);
      }
    } else if (action == 2) {
      cout << pr_arr[index].second << endl;
    }
  }
}
