#include <bits/stdc++.h>
using namespace std;
set<int> ms;
set<int>::iterator it;
int cur[200010], ful[200010];
int main() {
  int i, j, n, q, a, b, c, t, x, y, z, v;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &ful[i]);
    ms.insert(i);
  }
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d %d", &x, &v);
      while (true) {
        a = cur[x];
        b = ful[x];
        if (a + v <= b) {
          cur[x] += v;
          if (cur[x] == ful[x]) ms.erase(ms.find(x));
          break;
        } else if (cur[x] < ful[x]) {
          c = b - a;
          cur[x] = ful[x];
          if (cur[x] == ful[x]) ms.erase(ms.find(x));
          v = v - c;
        }
        it = ms.lower_bound(x + 1);
        if (it == ms.end())
          break;
        else
          x = *it;
      }
    } else {
      scanf("%d", &x);
      printf("%d\n", cur[x]);
    }
  }
  return 0;
}
