#include <bits/stdc++.h>
using namespace std;
int parent[200005];
int cap[200005];
int water[200005];
int Find(int a) {
  while (parent[a] != a) {
    parent[a] = parent[parent[a]];
    a = parent[a];
  }
  return a;
}
void Union(int a, int b) {
  int root_a = Find(a);
  int root_b = Find(b);
  if (root_a != root_b) parent[root_a] = root_b;
}
int main() {
  int n, i, a, b, c, m, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &cap[i]);
  for (i = 1; i <= n; i++) parent[i] = i;
  scanf("%d", &m);
  for (i = 0; i < m; i++) {
    scanf("%d", &a);
    if (a == 1) {
      scanf("%d%d", &b, &c);
      b = Find(b);
      if (c < cap[b]) {
        water[b] += c;
        cap[b] -= c;
      } else if (c == cap[b]) {
        water[b] += c;
        cap[b] -= c;
        Union(b, (b + 1));
      } else if (c > cap[b]) {
        while (c > 0) {
          water[b] += cap[b];
          c -= cap[b];
          cap[b] = 0;
          if (b == n && cap[b] == 0) {
            c = 0;
            continue;
          }
          Union(b, (b + 1));
          b = Find(b);
          if (c < cap[b] && c != 0) {
            water[b] += c;
            cap[b] -= c;
            c = 0;
          }
        }
      }
    } else if (a == 2) {
      scanf("%d", &b);
      printf("%d\n", water[b]);
    }
  }
}
