#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 5;
int pre[M];
struct Node {
  int l;
  int f;
} a[M];
int Find(int x) {
  int r = x;
  while (pre[r] != r) r = pre[r];
  int i = x;
  int j;
  while (pre[i] != r) {
    j = pre[i];
    pre[i] = r;
    j = i;
  }
  return r;
}
void join(int x, int y) {
  int tx = Find(x);
  int ty = Find(y);
  if (tx != ty) {
    if (tx < ty)
      pre[tx] = ty;
    else
      pre[ty] = tx;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].f);
    a[i].l = a[i].f;
    pre[i] = i;
  }
  pre[n + 1] = n + 1;
  int m;
  scanf("%d", &m);
  int t, p, x, tmp, r;
  for (int i = 1; i <= m; i++) {
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d%d", &p, &x);
      r = Find(p);
      while (x > 0 && r <= n) {
        if (a[r].l >= x) {
          tmp = x;
          a[r].l -= tmp;
        } else {
          tmp = a[r].l;
          a[r].l = 0;
          join(r, r + 1);
        }
        x -= tmp;
        r = Find(r);
      }
    } else if (t == 2) {
      scanf("%d", &p);
      printf("%d\n", a[p].f - a[p].l);
    }
  }
  return 0;
}
