#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 100;
int a[maxn];
int b[maxn];
int n, q;
set<int> second;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    second.insert(i);
  }
  cin >> q;
  while (q--) {
    int t;
    cin >> t;
    if (t == 1) {
      int p, x;
      cin >> p >> x;
      p--;
      int rem = x;
      while (second.lower_bound(p) != second.end()) {
        auto it = *second.lower_bound(p);
        if (rem + b[it] <= a[it]) {
          b[it] += rem;
          if (b[it] == a[it]) second.erase(it);
          break;
        } else {
          rem -= a[it] - b[it];
          b[it] = a[it];
          second.erase(it);
        }
      }
    } else if (t == 2) {
      int x;
      cin >> x;
      x--;
      cout << b[x] << endl;
    }
  }
}
