#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const double pi = 3.1415926535;
const int inf = 5e8;
const int maxn = 1e5 + 7;
const long long int mod = 1e9 + 7;
int n;
int cap[200007];
int kal[200007];
set<int> bos;
void solve() {
  int qt;
  scanf("%d", &qt);
  if (qt == 1) {
    int x, y;
    scanf("%d %d", &x, &y);
    set<int>::iterator it = bos.lower_bound(x);
    while (y) {
      if (it == bos.end()) break;
      int i = *it;
      int g = min(y, cap[i] - kal[i]);
      kal[i] += g;
      y -= g;
      set<int>::iterator it2 = it;
      it2++;
      if (kal[i] == cap[i]) bos.erase(it);
      it = it2;
    }
  } else {
    int x;
    scanf("%d", &x);
    printf("%d\n", kal[x]);
  }
}
int main() {
  int i, q;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &cap[i]);
    bos.insert(i);
    kal[i] = 0;
  }
  scanf("%d", &q);
  while (q--) solve();
}
