#include <bits/stdc++.h>
using namespace std;
int f, f1, n, i, a[300000], n1;
int a1[300000];
int parent[300000];
int children[300000];
set<int> s;
int main() {
  cin >> n;
  children[1] = 1 + 1;
  for (i = 2; i < n; i++) {
    parent[i] = i - 1;
    children[i] = i + 1;
  }
  parent[n] = n - 1;
  cin >> a[1];
  s.insert(1);
  a1[1] = a[1];
  for (i = 2; i <= n; i++) {
    cin >> a[i];
    a1[i] = a[i];
    s.insert(i);
  }
  cin >> n1;
  for (i = 1; i <= n1; i++) {
    int type;
    cin >> type;
    if (type == 1) {
      cin >> f >> f1;
      if (s.lower_bound(f) != s.end()) {
        int cur = *s.lower_bound(f);
        while (f1 != 0) {
          if (cur == 0) break;
          if (f1 >= a[cur]) {
            f1 = f1 - a[cur];
            a[cur] = 0;
            if (*s.lower_bound(cur) == 0) break;
            s.erase(s.lower_bound(cur));
            parent[children[cur]] = parent[cur];
            children[parent[cur]] = children[cur];
            cur = children[cur];
          } else {
            a[cur] = a[cur] - f1;
            f1 = 0;
          }
        }
      }
    }
    if (type == 2) {
      cin >> f;
      cout << a1[f] - a[f] << endl;
    }
  }
}
