#include <bits/stdc++.h>
using namespace std;
const int mn = 2e5 + 100;
const long long int inf = 1e18;
long long int par[mn], a[mn], mp[mn];
int getpar(int v) { return par[v] == v ? v : par[v] = getpar(par[v]); }
void merg(int x, int y) {
  x = getpar(x);
  y = getpar(y);
  if (x < y) {
    swap(x, y);
  }
  if (x == y) {
    return;
  }
  par[y] = x;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << setprecision(30);
  for (int i = 0; i < mn; i++) {
    par[i] = i;
    a[i] = inf;
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int m;
  cin >> m;
  while (m--) {
    int t;
    cin >> t;
    if (t == 2) {
      int k;
      cin >> k;
      k--;
      cout << mp[k] << "\n";
    } else {
      int p, x;
      cin >> p >> x;
      p--;
      p = getpar(p);
      while (a[p] - mp[p] > 0) {
        if (x < a[p] - mp[p]) {
          mp[p] += x;
          break;
        }
        x -= (a[p] - mp[p]);
        mp[p] = a[p];
        merg(p, p + 1);
        p = getpar(p);
      }
    }
  }
  return 0;
}
