#include <bits/stdc++.h>
using namespace std;
int n, m;
int ves[(int)2e5 + 6];
pair<int, int> a[(int)2e5 + 6];
int f(int p, int x) {
  if (a[p].first == -1) return -1;
  if (a[a[p].first].second > x) {
    a[a[p].first].second -= x;
    return a[p].first;
  }
  if (a[p].first == n) {
    a[n].first = -1;
    a[n].second = 0;
    return -1;
  }
  int t = x - a[a[p].first].second;
  a[a[p].first].second = 0;
  a[p].first = f(a[p].first + 1, t);
  return a[p].first;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++)
    scanf("%d", ves + i), a[i].first = i, a[i].second = ves[i];
  cin >> m;
  while (m--) {
    int t, x, p;
    scanf("%d", &t);
    if (t == 1)
      scanf("%d %d", &p, &x), f(p, x);
    else
      scanf("%d", &x), printf("%d\n", ves[x] - a[x].second);
  }
}
