#include <bits/stdc++.h>
using namespace std;
struct _VESSEL {
  int cap;
  int level;
} vessel[(200000) + 4];
int N, Q;
int main() {
  int t, p, x;
  scanf("%d", &N);
  set<int> s;
  for (int i = 1; i <= N; i++) {
    scanf("%d", &vessel[i].cap);
    s.insert(i);
  }
  scanf("%d", &Q);
  for (int i = 0; i < Q; i++) {
    scanf("%d%d", &t, &p);
    if (t == 1) {
      scanf("%d", &x);
      while (x > 0) {
        if (vessel[p].cap - vessel[p].level > x) {
          vessel[p].level += x;
          break;
        } else {
          x -= vessel[p].cap - vessel[p].level;
          vessel[p].level = vessel[p].cap;
          s.erase(p);
          set<int>::iterator i = s.upper_bound(p);
          if (i != s.end() && ((p = *i) <= N)) {
            continue;
          } else
            break;
        }
      }
    } else {
      printf("%d\n", vessel[p].level);
    }
  }
  return 0;
}
