#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int inf = 1e9 + 7;
int n, a[N], m, k, x, t, b[N];
set<int> s;
set<int>::iterator it, it2;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    s.insert(i);
  }
  cin >> m;
  for (int i = 1; i <= m; i++) {
    cin >> t >> k;
    if (t == 2) {
      cout << b[k] << endl;
    } else {
      cin >> x;
      it = s.lower_bound(k);
      while (it != s.end()) {
        if (x == 0) break;
        if (a[*it] - b[*it] > x) {
          b[*it] += x;
          x = 0;
          break;
        } else {
          x -= (a[*it] - b[*it]);
          b[*it] = a[*it];
          it2 = it;
          *it++;
          s.erase(*it2);
        }
      }
    }
  }
}
