#include <bits/stdc++.h>
using namespace std;
long long int vis[200005];
long long int parent[200005];
long long int cap[200005];
void solve() {
  long long int i, n, q, a, b, x, y, here, p, m, k;
  cin >> n;
  set<long long int> second;
  for (i = 1; i <= n; i++) {
    vis[i] = 0;
    cin >> cap[i];
    second.insert(i);
  }
  cin >> m;
  while (m--) {
    cin >> q;
    if (q == 1) {
      cin >> p >> x;
      while (x && second.size() > 0) {
        auto it = second.lower_bound(p);
        if (it == second.end()) break;
        y = vis[*it];
        vis[*it] = min(cap[*it], x + vis[*it]);
        x -= (vis[*it] - y);
        if (vis[*it] == cap[*it]) second.erase(it);
      }
    } else {
      cin >> k;
      cout << vis[k] << "\n";
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t = 1;
  while (t--) solve();
  return 0;
}
