#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 200005;
const int LOG_N_MAX = 20;
int N;
int NUM_UNFULL[LOG_N_MAX][N_MAX];
long long CAPACITY[N_MAX];
long long USED[N_MAX];
void init() {
  for (int j = 0; j < N_MAX; j++) {
    CAPACITY[j] = 0;
  }
  for (int j = 0; j < N_MAX; j++) {
    USED[j] = 0;
  }
  for (int i = 1; i < LOG_N_MAX; i++) {
    for (int j = 0; j < N_MAX; j++) {
      NUM_UNFULL[i][j] = 0;
    }
  }
  for (int j = 0; j < N; j++) {
    NUM_UNFULL[0][j] = 1;
  }
  for (int i = 1; i < LOG_N_MAX; i++) {
    int width = N / (1 << i) + 1;
    for (int j = 0; j < width; j++) {
      NUM_UNFULL[i][j] =
          NUM_UNFULL[i - 1][2 * j] + NUM_UNFULL[i - 1][2 * j + 1];
    }
  }
}
void print_unfulls_matrix() {
  cout << "UNFILLED" << endl;
  for (int i = 0; i < min(LOG_N_MAX, 4); i++) {
    for (int j = 0; j < N; j++) {
      cout << NUM_UNFULL[i][j] << " ";
    }
    cout << endl;
  }
}
void mark_full(const int ix) {
  int j = ix;
  for (int i = 0; i < LOG_N_MAX; i++) {
    NUM_UNFULL[i][j]--;
    j /= 2;
  }
}
int num_unfull_prefix(const int ix) {
  int sum = 0;
  int j = ix;
  for (int i = 0; i < LOG_N_MAX && j > 0; i++) {
    if (j % 2 == 1) {
      sum += NUM_UNFULL[i][j - 1];
    } else {
    }
    j /= 2;
  }
  return sum;
}
int num_unfull(int left, int right) {
  return num_unfull_prefix(right) - num_unfull_prefix(left);
}
int next_unfull(const int ix) {
  if (USED[ix] < CAPACITY[ix]) {
    return ix;
  }
  int left = ix + 1;
  int right = N;
  while (left + 1 < right) {
    int midpt = (left + right) / 2;
    int num_unfull_in_left_half = num_unfull(left, midpt);
    if (num_unfull_in_left_half > 0) {
      right = midpt;
    } else {
      left = midpt;
    }
  }
  return left;
}
void add_water(const int loc, const long long amt_water) {
  if (amt_water <= 0 || loc >= N) {
    return;
  }
  long long amt_water_added = 0;
  if (USED[loc] < CAPACITY[loc]) {
    amt_water_added = min(amt_water, CAPACITY[loc] - USED[loc]);
    USED[loc] += amt_water_added;
    if (USED[loc] == CAPACITY[loc]) {
      mark_full(loc);
    }
  }
  add_water(next_unfull(loc), amt_water - amt_water_added);
}
int get_water(const int loc) { return USED[loc]; }
int main() {
  cin >> N;
  init();
  for (int i = 0; i < N; i++) {
    cin >> CAPACITY[i];
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int instruction;
    cin >> instruction;
    if (instruction == 1) {
      int p;
      long long x;
      cin >> p >> x;
      add_water(p - 1, x);
    } else if (instruction == 2) {
      int k;
      cin >> k;
      cout << get_water(k - 1) << endl;
    }
  }
}
