#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10, MOD = 1e9 + 7, INF = 1e9 + 5;
int n, a[MAXN], have[MAXN];
bool mark[MAXN];
set<int> s;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    s.insert(i);
  }
  int q, type, p, x;
  cin >> q;
  while (q--) {
    cin >> type;
    if (type == 1) {
      cin >> p >> x;
      p--;
      while (x) {
        auto it = s.lower_bound(p);
        if (it == s.end()) {
          break;
        }
        p = *it;
        int tmp = min(x, a[p] - have[p]);
        have[p] += tmp;
        x -= tmp;
        if (have[p] == a[p]) {
          s.erase(it);
        } else
          break;
      }
    } else {
      cin >> p;
      p--;
      cout << have[p] << '\n';
    }
  }
}
