#include <bits/stdc++.h>
using namespace std;
int n, cap[200005], fat[200005], us[200005], m, t1, t2, id;
int fin(int x) {
  if (fat[x] != x) return fat[x] = fin(fat[x]);
  return fat[x];
}
void unio(int a, int b) {
  int aa = fin(a);
  int bb = fin(b);
  if (aa != bb) fat[aa] = fat[bb];
}
void pour(int a, int b) {
  if (a == n)
    us[a] = min(cap[a], us[a] + b);
  else {
    if (us[a] + b > cap[a]) {
      pour(fin(a + 1), b - (cap[a] - us[a]));
      us[a] = cap[a];
      unio(a, a + 1);
    } else
      us[a] += b;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie();
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &cap[i]), fat[i] = i;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &id);
    if (id == 1) {
      scanf("%d %d", &t1, &t2);
      pour(fin(t1), t2);
    } else {
      scanf("%d", &t1);
      if (fat[t1] != t1)
        printf("%d\n", cap[t1]);
      else
        printf("%d\n", us[t1]);
    }
  }
  return 0;
}
