#include <bits/stdc++.h>
const int N = 200005;
std::pair<int, int> a[N];
std::set<int> s;
int main() {
  int n;
  std::cin >> n;
  for (int i = 1; i <= n; ++i) std::cin >> a[i].second;
  for (int i = 1; i <= n; ++i) s.insert(i);
  int m;
  std::cin >> m;
  while (m--) {
    int t;
    std::cin >> t;
    if (t == 1) {
      int pos, val;
      std::cin >> pos >> val;
      while (val > 0) {
        auto it = s.lower_bound(pos);
        if (it == s.end()) break;
        if (val >= a[*it].second - a[*it].first) {
          val -= (a[*it].second - a[*it].first);
          a[*it].first = a[*it].second;
          s.erase(it);
        } else {
          a[*it].first += val;
          val = 0;
        }
      }
    } else {
      int pos;
      std::cin >> pos;
      std::cout << a[pos].first << '\n';
    }
  }
}
