#include <bits/stdc++.h>
using namespace std;
int cap[200005];
int empty[200005];
int main() {
  int n, i, m, z, p, k, x;
  cin >> n;
  set<int> unfilled;
  for (i = 1; i <= n; i++) {
    cin >> cap[i];
    unfilled.insert(i);
    empty[i] = cap[i];
  }
  cin >> m;
  for (i = 1; i <= m; i++) {
    cin >> z;
    if (z == 1) {
      cin >> p >> x;
      set<int>::iterator it = unfilled.upper_bound(p - 1);
      int flag = 0;
      while (it != unfilled.end() && flag == 0) {
        int l = *it;
        if (x >= empty[l]) {
          x = x - empty[l];
          empty[l] = 0;
          it++;
          unfilled.erase(l);
        } else {
          empty[l] = empty[l] - x;
          it++;
          flag = 1;
        }
      }
    } else {
      cin >> k;
      int l = cap[k] - empty[k];
      cout << l << "\n";
    }
  }
}
