#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<long long> vessel_cap(n + 1, 0);
  vector<int> next_unfilled(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    cin >> vessel_cap[i];
    next_unfilled[i] = i;
  }
  int queries;
  cin >> queries;
  vector<long long> curr_water(n + 1, 0);
  while (queries--) {
    int type;
    cin >> type;
    if (type == 1) {
      long long water, ves_num;
      cin >> ves_num >> water;
      int to_fill = next_unfilled[ves_num];
      if (to_fill > n) {
        continue;
      }
      int i;
      for (i = to_fill; i <= n && water; i++) {
        long long taken = min(vessel_cap[i] - curr_water[i], water);
        water -= taken;
        curr_water[i] += taken;
      }
      int last_filled = i - 1;
      if (vessel_cap[last_filled] - curr_water[last_filled]) {
        for (int k = last_filled; k >= ves_num; k--) {
          next_unfilled[k] = last_filled;
        }
      } else {
        for (int k = last_filled; k >= ves_num; k--) {
          next_unfilled[k] = last_filled + 1;
        }
      }
    } else {
      int vessel_num;
      cin >> vessel_num;
      cout << curr_water[vessel_num] << "\n";
    }
  }
}
int main() {
  int t;
  t = 1;
  while (t--) solve();
  return 0;
}
