#include <bits/stdc++.h>
using namespace std;
void start() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  long long n, i, m, k, l, j;
  cin >> n;
  long long a[n + 1];
  for (i = 1; i <= n; i++) cin >> a[i];
  long long b[200010] = {0};
  cin >> m;
  set<long long> s;
  for (i = 1; i <= n; i++) s.insert(i);
  set<long long>::iterator it;
  while (m--) {
    long long c, p;
    cin >> c;
    if (c == 1) {
      cin >> p >> k;
      while (k > 0 && s.size() != 0) {
        if (b[p] < a[p]) {
          j = a[p] - b[p];
          if (k >= j)
            k -= j;
          else {
            j = k;
            k = 0;
          }
          b[p] += j;
          if (b[p] == a[p]) s.erase(p);
        }
        it = s.upper_bound(p);
        if (it != s.end())
          p = *it;
        else
          break;
      }
    } else {
      cin >> p;
      cout << b[p] << endl;
    }
  }
}
