#include <bits/stdc++.h>
long long mod = 1000000007;
using namespace std;
int n;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long curr[200001];
long long cap[200001];
long long par[200001];
int main() {
  int i, j, fl, test;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &cap[i]);
  }
  scanf("%d", &test);
  for (i = 1; i <= n; i++) {
    par[i] = i;
  }
  cap[n] = 1000000000000000000ll;
  while (test--) {
    int ch;
    scanf("%d", &ch);
    if (ch == 2) {
      scanf("%d", &j);
      printf("%d\n", curr[j - 1]);
    } else {
      int x;
      scanf("%d%d", &j, &x);
      j--;
      while (x) {
        if (cap[j] >= curr[j] + x) {
          curr[j] = curr[j] + x;
          break;
        } else {
          x = x - (cap[j] - curr[j]);
          curr[j] = cap[j];
          if (par[j] == j) {
            par[j] = j + 1;
          } else {
            par[j] = par[par[j]];
          }
          j = par[j];
        }
      }
    }
  }
  return 0;
}
