#include <bits/stdc++.h>
using namespace std;
long long n, a, b, x, k;
struct data {
  long long res, e;
};
data tree[300300];
void updt(int nd, int lft, int rt, long long e) {
  if (e != 0) tree[nd].res = e, tree[nd].e = e;
  if (lft > b || rt < a) return;
  if (lft >= a && rt <= b) {
    tree[nd].res = x;
    tree[nd].e = x;
    return;
  }
  long long E = tree[nd].e;
  tree[nd].e = 0;
  updt(nd * 2, lft, (lft + rt) / 2, E);
  updt(nd * 2 + 1, (rt + lft) / 2 + 1, rt, E);
  tree[nd].res = max(tree[nd * 2].res, tree[nd * 2 + 1].res);
}
long long qwry(int nd, int lft, int rt, long long e) {
  if (e != 0) tree[nd].res = e, tree[nd].e = e;
  if (lft > b || rt < a) return -1;
  if (lft >= a && rt <= b) return tree[nd].res;
  long long E = tree[nd].e;
  tree[nd].e = 0;
  long long A = qwry(nd * 2, lft, (lft + rt) / 2, E);
  long long B = qwry(nd * 2 + 1, (lft + rt) / 2 + 1, rt, E);
  return max(A, B);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    a = i;
    b = i;
    updt(1, 1, n, 0);
  }
  cin >> k;
  for (int i = 1; i <= k; i++) {
    long long c, d;
    cin >> c >> d;
    a = 1, b = c;
    long long v = qwry(1, 1, n, 0);
    cout << v << endl;
    x = v + d;
    updt(1, 1, n, 0);
  }
}
