#include <bits/stdc++.h>
using namespace std;
const long long MX = 1e18;
const long long MD = 1e9 + 7;
const long long MXX = 1e6 + 6;
long long n, mx[200005], co[200005];
set<long long> s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> mx[i];
    s.insert(i);
  }
  s.insert(n);
  int q;
  cin >> q;
  while (q--) {
    long long t, x, p;
    cin >> t >> x;
    if (t == 1) {
      cin >> p;
      while (p > 0) {
        set<long long>::iterator id = s.lower_bound(x - 1);
        if (id == s.end()) break;
        int u = *id;
        long long w = co[u];
        co[u] += min(mx[u] - co[u], p);
        p -= min(mx[u] - w, p);
        if (co[u] == mx[u]) s.erase(id++);
      }
    }
    if (t == 2) cout << co[x - 1] << endl;
  }
}
