#include <bits/stdc++.h>
using namespace std;
struct N {
  long long val, lazy;
  N() : val(0), lazy(0) {}
};
int n, m;
vector<long long> arr;
vector<N> tree;
long long update(int qs, int qe, int vs, int ve, int node, long long niew) {
  int mid;
  long long lazy;
  lazy = tree[node].lazy;
  tree[node].lazy = 0;
  tree[node].val = max(tree[node].val, lazy);
  tree[2 * node].lazy = max(tree[2 * node].lazy, lazy);
  tree[(2 * node) + 1].lazy = max(tree[(2 * node) + 1].lazy, lazy);
  if ((vs > qe) || (ve < qs)) return tree[node].val;
  if ((qs <= vs) && (ve <= qe)) {
    tree[node].val = niew;
    if (vs == ve) arr[vs] = niew;
    tree[2 * node].lazy = niew;
    tree[(2 * node) + 1].lazy = niew;
  } else {
    mid = (vs + ve) / 2;
    tree[node].val = max(update(qs, qe, vs, mid, 2 * node, niew),
                         update(qs, qe, mid + 1, ve, (2 * node) + 1, niew));
  }
  return tree[node].val;
}
long long query(int qs, int qe, int vs, int ve, long long node) {
  int mid;
  long long lazy;
  if ((vs > qe) || (ve < qs)) return 0;
  lazy = tree[node].lazy;
  tree[node].lazy = 0;
  tree[node].val = max(tree[node].val, lazy);
  tree[2 * node].lazy = max(tree[2 * node].lazy, lazy);
  tree[(2 * node) + 1].lazy = max(tree[(2 * node) + 1].lazy, lazy);
  if ((qs <= vs) && (ve <= qe)) return tree[node].val;
  mid = (vs + ve) / 2;
  return max(query(qs, qe, vs, mid, 2 * node),
             query(qs, qe, mid + 1, ve, (2 * node) + 1));
}
void make() {
  tree.resize(1000005);
  for (int i = 1; i <= n; i++) update(i, i, 1, n, 1, arr[i]);
}
int main() {
  int w;
  long long h, mx;
  scanf("%d", &n);
  arr.resize(n + 5);
  for (int i = 1; i <= n; i++) scanf("%I64d", &arr[i]);
  make();
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d %I64d", &w, &h);
    mx = query(1, w, 1, n, 1);
    printf("%I64d\n", mx);
    update(1, w, 1, n, 1, mx + h);
  }
  return 0;
}
