#include <bits/stdc++.h>
using namespace std;
int main() {
  int numOfVessels;
  cin >> numOfVessels;
  int* capacity = new int[numOfVessels];
  int* filled = new int[numOfVessels];
  set<int> notFull;
  for (int i = 1; i <= numOfVessels; i++) {
    cin >> capacity[i - 1];
    filled[i - 1] = 0;
    notFull.insert(i);
  }
  int numOfQueries;
  cin >> numOfQueries;
  for (int j = 0; j < numOfQueries; j++) {
    int type;
    cin >> type;
    int vessel;
    cin >> vessel;
    if (type == 1) {
      int litres;
      cin >> litres;
      set<int>::iterator vessel_iter = notFull.lower_bound(vessel);
      while (vessel_iter != notFull.end()) {
        vessel = *vessel_iter;
        int remaining = capacity[vessel - 1] - filled[vessel - 1];
        if (remaining > litres) {
          filled[vessel - 1] += litres;
          break;
        }
        filled[vessel - 1] = capacity[vessel - 1];
        notFull.erase(vessel);
        vessel_iter = notFull.lower_bound(vessel);
        litres -= remaining;
      }
    } else {
      cout << filled[vessel - 1] << endl;
    }
  }
  delete[] capacity;
  delete[] filled;
  return 0;
}
