#include <bits/stdc++.h>
const int Maxn = 2e5 + 10;
using namespace std;
int n, q;
int v[Maxn];
int ans[Maxn];
int nxt[Maxn];
int main() {
  int zz;
  int f[Maxn];
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &v[i]);
    nxt[i] = i + 1;
  }
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &zz);
    if (zz == 1) {
      int a, b;
      scanf("%d%d", &a, &b);
      int zk = a;
      int cnt = 0;
      while (b && zk <= n) {
        if (b <= v[zk] - ans[zk]) {
          ans[zk] += b;
          b = 0;
        } else {
          int k = v[zk] - ans[zk];
          ans[zk] = v[zk];
          b -= k;
          f[++cnt] = zk;
          zk = nxt[zk];
        }
      }
      for (int i = 1; i <= cnt; i++) nxt[f[i]] = zk;
    } else {
      int a;
      scanf("%d", &a);
      printf("%d\n", ans[a]);
    }
  }
  return 0;
}
