#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
int a[MAXN];
int v[MAXN];
int main() {
  int n;
  set<int> S;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    S.insert(i);
  }
  memset(v, 0, sizeof(v));
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int t, p, x;
    cin >> t;
    if (t == 1) {
      cin >> p >> x;
      p--;
      int start = p;
      while (x > 0) {
        if (v[start] == a[start]) {
          if (S.upper_bound(start) != S.end()) {
            start = *(S.upper_bound(start));
          } else {
            x = 0;
            break;
          }
        }
        int can_fill = a[start] - v[start];
        if (can_fill <= x) {
          x -= can_fill;
          S.erase(start);
          v[start] = a[start];
        } else {
          v[start] += x;
          x = 0;
          break;
        }
      }
    } else {
      cin >> p;
      p--;
      cout << v[p] << endl;
    }
  }
  return 0;
}
