#include <bits/stdc++.h>
using namespace std;
int N = 2e5 + 4;
int inf = 1e9 + 1;
set<int> s;
int main() {
  int n;
  cin >> n;
  int c[n + 2], org[n + 2];
  for (int i = 1; i <= n; i++) {
    s.insert(i);
    cin >> c[i];
    org[i] = c[i];
  }
  s.insert(n + 1);
  c[n + 1] = inf;
  org[n + 1] = inf;
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int a, p, x;
    cin >> a;
    if (a == 1) {
      cin >> p >> x;
      while (c[p] <= x) {
        x -= c[p];
        c[p] = 0;
        s.erase(p);
        auto it = s.upper_bound(p);
        p = *it;
      }
      c[p] -= x;
      if (p == n + 1) c[n + 1] = inf;
    } else if (a == 2) {
      cin >> p;
      cout << org[p] - c[p] << '\n';
    }
  }
}
