#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
long long int n, remm[200010], actual_pos[200010];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  clock_t clk = clock();
  int q;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> remm[i], actual_pos[i] = remm[i];
  remm[n + 1] = 1e15;
  cin >> q;
  set<int> stations;
  for (int i = 1; i <= n + 1; i++) stations.insert(i);
  while (q--) {
    int type;
    cin >> type;
    if (type == 1) {
      int vess, pour;
      cin >> vess >> pour;
      while (pour != 0) {
        int go_to = *(stations.lower_bound(vess));
        if (remm[go_to] > pour) {
          remm[go_to] -= pour;
          pour = 0;
        } else {
          pour -= remm[go_to];
          remm[go_to] = 0;
          stations.erase(go_to);
        }
      }
    } else {
      int ves;
      cin >> ves;
      cout << actual_pos[ves] - remm[ves] << endl;
    }
  }
  cerr << endl
       << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;
  return 0;
}
