#include <bits/stdc++.h>
using namespace std;
int a[320000], v[320000], n, m, s, p, x, next1[320000];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    next1[i] = i + 1;
  }
  next1[n + 1] = n + 1;
  cin >> m;
  while (m--) {
    cin >> s;
    if (s == 1) {
      cin >> p >> x;
      int i, j;
      for (i = p; i <= n; i = next1[i]) {
        if (v[i] == a[i]) continue;
        int temp = min(a[i] - v[i], x);
        v[i] += temp;
        x -= temp;
        if (!x) break;
      }
      if (v[i] == a[i]) i++;
      int t;
      for (j = p; j < i; j = t) {
        t = next1[j];
        next1[j] = i;
      }
    } else if (s == 2) {
      cin >> p;
      cout << v[p] << endl;
    }
  }
  return 0;
}
