#include <bits/stdc++.h>
using namespace std;
long long constexpr max_n = 2e5 + 10;
long long p[max_n], m[max_n], a[max_n], n, q;
long long g_par(long long x) {
  while (p[x] != x) x = p[x];
  return x;
}
void add(long long x, long long y) {
  if (a[p[x]] + y <= m[p[x]])
    a[p[x]] += y;
  else {
    y -= m[p[x]] - a[p[x]];
    a[p[x]] = m[p[x]];
    if (p[x] != n - 1) {
      p[x] = g_par(p[x] + 1);
      add(p[x], y);
    }
  }
}
int32_t main() {
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> m[i];
  cin >> q;
  for (long long i = 0; i < n; i++) p[i] = i;
  while (q--) {
    long long x, y;
    cin >> x;
    if (x == 1) {
      cin >> x >> y;
      x--;
      add(x, y);
    } else {
      cin >> x;
      x--;
      cout << a[x] << '\n';
    }
  }
}
