#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > myset;
vector<pair<int, int> > tmp;
int a[200010], n, m;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    myset.insert(make_pair(i, a[i]));
  }
  scanf("%d", &m);
  while (m--) {
    int op, x, k;
    scanf("%d%d", &op, &x);
    if (op == 1) {
      scanf("%d\n", &k);
      set<pair<int, int> >::iterator it = myset.lower_bound(make_pair(x, 0));
      tmp.clear();
      while (it != myset.end() && k) {
        if (it->second >= k) {
          pair<int, int> res = make_pair(it->first, it->second - k);
          myset.erase(it);
          myset.insert(res);
          break;
        } else {
          tmp.push_back(*it);
          k -= it->second;
        }
        it++;
      }
      for (int i = 0; i < tmp.size(); i++) {
        myset.erase(tmp[i]);
      }
    } else {
      set<pair<int, int> >::iterator it = myset.lower_bound(make_pair(x, 0));
      if (it == myset.end() || it->first != x) {
        printf("%d\n", a[x]);
      } else {
        printf("%d\n", a[x] - (it->second));
      }
    }
  }
  return 0;
}
