#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
long long a[N], b[N], c[N], n, m, p, x, k;
int find(int i) { return (b[i] == i ? i : b[i] = find(b[i])); }
void query(int p, int x) {
  while (x > 0) {
    int y = find(p), z = a[y];
    a[y] = min(c[y], a[y] + x);
    x -= a[y] - z;
    if (a[y] == c[y]) p = find(y + 1), b[y] = find(y + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> c[i];
  c[n + 1] = 2e18;
  for (int i = 1; i <= n + 2; i++) b[i] = i;
  cin >> m;
  while (m--) {
    cin >> k;
    if (k == 1) {
      cin >> p >> x;
      query(p, x);
    } else {
      cin >> x;
      cout << a[x] << "\n";
    }
  }
  return 0;
}
