#include <bits/stdc++.h>
using namespace std;
int n, m, k, l, i, j, a, b, d[200005], g[200005];
set<int> s;
int main() {
  cin >> n;
  s.insert(1000000000);
  for (i = 1; i <= n; i++) {
    cin >> d[i];
    s.insert(i);
  }
  cin >> m;
  for (i = 0; i < m; i++) {
    cin >> l >> a;
    if (l == 1) {
      cin >> b;
      set<int>::iterator it1, it = s.lower_bound(a);
      while (1) {
        k = *it;
        if (k == 1000000000) break;
        if (g[k] + b <= d[k]) {
          g[k] += b;
          break;
        } else {
          b -= (d[k] - g[k]);
          g[k] = d[k];
          it++;
          it1 = it;
          it--;
          s.erase(it);
          it = it1;
        }
      }
    } else
      cout << g[a] << endl;
  }
}
