#include <bits/stdc++.h>
using namespace std;
const int Max_N = 200008;
int Right[Max_N];
int now[Max_N];
int limit[Max_N];
int N, M;
int find_right(int id, int x) {
  if (id != -1) {
    int leave = limit[id] - now[id];
    if (leave >= x) {
      now[id] += x;
      return id;
    } else {
      now[id] = limit[id];
      return Right[id] = find_right(Right[id], x - leave);
    }
  } else
    return -1;
}
int main() {
  int kind, id, x;
  while (scanf("%d", &N) != EOF) {
    for (int i = 1; i <= N; i++) {
      scanf("%d", &limit[i]);
      now[i] = 0;
      Right[i] = i + 1;
    }
    Right[N] = -1;
    scanf("%d", &M);
    while (M--) {
      scanf("%d%d", &kind, &id);
      if (kind == 1) {
        scanf("%d", &x);
        find_right(id, x);
      } else
        printf("%d\n", now[id]);
    }
  }
  return 0;
}
