#include <bits/stdc++.h>
using namespace std;
const int L = 2e5 + 7;
bool mark[L];
int cap[L], parent[L], child[L], org[L], n, current[L];
std::vector<int> v[L];
int dfs(int i, int val) {
  if (i > n) return n;
  if (val <= 0) return i;
  if (i == n) {
    cap[i] = max(0, cap[i] - val);
    return i;
  }
  if (val < cap[i]) {
    cap[i] -= val;
    return i;
  }
  int tmp = cap[i];
  cap[i] = 0;
  child[parent[i]] = child[i];
  parent[child[i]] = parent[i];
  child[i] = dfs(child[i], val - tmp);
  return child[i];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int p, x, k, type, m;
  cin >> n;
  for (int i = 1; i < n + 1; ++i) {
    cin >> cap[i];
    org[i] = cap[i];
  }
  for (int i = 1; i < n; ++i) {
    child[i] = i + 1;
    parent[i + 1] = i;
  }
  cin >> m;
  while (m--) {
    cin >> type;
    if (type == 1) {
      cin >> p >> x;
      dfs(p, x);
    } else {
      cin >> k;
      cout << org[k] - cap[k] << "\n";
    }
  }
  return 0;
}
