#include <bits/stdc++.h>
using namespace std;
int n;
long long a[200005], c[200005];
set<int> w;
int main() {
  scanf("%d", &n);
  for (int i = 0, ThxDem = n; i < ThxDem; ++i)
    scanf("%lld", a + i), c[i] = a[i];
  a[n] = 1LL << 60;
  for (int i = 0, ThxDem = n + 1; i < ThxDem; ++i) w.insert(i);
  int m;
  scanf("%d", &m);
  while (m--) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int p;
      long long x;
      scanf("%d%lld", &p, &x);
      p--;
      while (x) {
        int i = *w.lower_bound(p);
        long long t = min(x, a[i]);
        x -= t;
        a[i] -= t;
        if (!a[i]) w.erase(i);
      }
    } else {
      int i;
      scanf("%d", &i);
      i--;
      printf("%lld\n", c[i] - a[i]);
    }
  }
  return 0;
}
