#include <bits/stdc++.h>
const double eps = (1e-10);
using namespace std;
int dcmp(double a, double b) {
  return fabs(a - b) <= eps ? 0 : (a > b) ? 1 : -1;
}
long long getBit(int num, int idx) { return ((num >> idx) & 1) == 1; }
long long setBit1(long long num, int idx) { return num | (1ll << idx); }
long long setBit0(long long num, int idx) { return num & ~(1ll << idx); }
long long flipBit(long long num, int idx) { return num ^ (1ll << idx); }
void M() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int countNumBit1(long long mask) {
  int ret = 0;
  while (mask) {
    mask &= (mask - 1ll);
    ++ret;
  }
  return ret;
}
const int inf = INT_MAX;
const int MAX = 1000000 + 9;
int par[MAX];
int v[MAX], rem[MAX];
int N;
void intial() {
  for (int i = 1; i <= N; i++) par[i] = i;
}
int getpar(int n) {
  if (par[n] == n) return n;
  return par[n] = getpar(par[n]);
}
int main() {
  scanf("%d", &N);
  intial();
  int no;
  for (int i = 1; i <= N; i++) {
    scanf("%d", &no);
    v[i] = no;
    rem[i] = no;
  }
  int q;
  cin >> q;
  while (q--) {
    int st, p, x;
    scanf("%d %d", &st, &p);
    if (st == 1) {
      scanf("%d", &x);
      int prev = -1, fl = 0;
      while (p <= N && fl == 0) {
        if (rem[p] <= x) {
          x -= rem[p];
          rem[p] = 0;
          if (prev != -1) par[prev] = p;
          prev = p;
          int w = getpar(p);
          p = (w == p ? p + 1 : w);
        } else {
          rem[p] -= x, x = 0;
          par[prev] = p;
          fl = 1;
        }
      }
    } else
      printf("%d\n", v[p] - rem[p]);
  }
}
