#include <bits/stdc++.h>
using namespace std;
const int maxN = 2e5 + 5;
int a[maxN], n, pre[maxN], v[maxN], m, type, ind, x, last_full, wody;
set<int> S;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    S.insert(i);
  }
  S.insert(1234567);
  cin >> m;
  while (m--) {
    cin >> type;
    if (type == 1) {
      cin >> ind >> x;
      int i = *S.upper_bound(ind - 1);
      while (i <= n && x > 0) {
        int d = min(x, a[i] - v[i]);
        v[i] += d;
        x -= d;
        if (v[i] == a[i]) S.erase(i);
        i = *S.upper_bound(i);
      }
    } else {
      cin >> ind;
      cout << v[ind] << "\n";
    }
  }
}
