#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
int f[MAXN], n, m, a[MAXN];
set<int> S;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i], S.insert(i);
  cin >> m;
  for (int i = 0; i < m; i++) {
    int t, p, x;
    cin >> t >> p;
    p--;
    if (t == 1) {
      cin >> x;
      while (S.lower_bound(p) != S.end()) {
        int ind = *S.lower_bound(p), tmp = min(f[ind] + x, a[ind]);
        x -= tmp - f[ind];
        f[ind] = tmp;
        if (f[ind] == a[ind])
          S.erase(S.lower_bound(p));
        else
          break;
      }
    } else
      cout << f[p] << '\n';
  }
}
