#include <bits/stdc++.h>
const int maxn = 200005;
int v[maxn], fa[maxn], ans[maxn], num[maxn];
int n, m;
int findset(int x) {
  if (fa[x] != x) {
    fa[x] = findset(fa[x]);
  }
  return fa[x];
}
void _union(int x, int y) {
  int p = findset(x);
  int q = findset(y);
  if (p != q) {
    fa[p] = q;
  }
}
int main() {
  int a, x, y;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &v[i]);
    num[i] = v[i];
    fa[i] = i;
  }
  fa[n + 1] = n + 1;
  scanf("%d", &m);
  while (m--) {
    scanf("%d", &a);
    if (a == 1) {
      scanf("%d%d", &x, &y);
      while (y > 0) {
        x = findset(x);
        if (x == n + 1) break;
        if (num[x] > y) {
          ans[x] += y;
          num[x] -= y;
          y = 0;
        } else {
          y -= num[x];
          ans[x] = v[x];
          num[x] = 0;
          _union(x, x + 1);
        }
      }
    } else if (a == 2) {
      scanf("%d", &x);
      printf("%d\n", ans[x]);
    }
  }
  return 0;
}
