#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, m;
  cin >> n;
  vector<long long> vec(n + 1, 0);
  vector<long long> vec2(n + 1, 0);
  set<long long> inds;
  for (long long i = 1; i <= n; i++) {
    cin >> vec[i];
    inds.insert(i);
  }
  cin >> m;
  for (long long opn = 0; opn < m; opn++) {
    long long type;
    cin >> type;
    if (type == 1) {
      long long p, x;
      cin >> p >> x;
      for (set<long long>::iterator it = inds.lower_bound(p);
           it != inds.end() && x;) {
        long long id = *it;
        long long add = min(vec[id] - vec2[id], x);
        vec2[id] += add;
        x -= add;
        if (vec2[id] == vec[id]) {
          set<long long>::iterator it2 = it;
          it++;
          inds.erase(it2);
        } else
          it++;
      }
    } else if (type == 2) {
      long long id;
      cin >> id;
      cout << vec2[id] << endl;
    }
  }
  return 0;
}
