#include <bits/stdc++.h>
using namespace std;
int vessels[200010];
int tree[200010];
int num[200010];
int find(int x) { return x == tree[x] ? x : tree[x] = find(tree[x]); }
void merge(int x, int y) {
  int a = find(x);
  int b = find(y);
  if (a != b) tree[a] = b;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &vessels[i]);
    num[i] = vessels[i];
  }
  for (int i = 1; i <= n; i++) tree[i] = i;
  int op;
  cin >> op;
  while (op--) {
    int type;
    cin >> type;
    if (type == 1) {
      int x, water;
      cin >> x >> water;
      int father = find(x);
      while (water > vessels[father] && father <= n) {
        water -= vessels[father];
        if (father - x) merge(father - 1, father);
        vessels[father++] = 0;
      }
      vessels[father] -= water;
    } else {
      int que;
      cin >> que;
      cout << num[que] - vessels[que] << endl;
    }
  }
}
