#include <bits/stdc++.h>
using namespace std;
long long t[262144], d[262144], P, Q, V;
void insert(int x, int l, int r) {
  if (l == r) {
    t[x] = V;
    return;
  }
  int m = l + r >> 1, t1 = x * 2, t2 = t1 + 1;
  ;
  if (P <= m)
    insert(t1, l, m);
  else
    insert(t2, m + 1, r);
  t[x] = max(t[t1], t[t2]);
}
void select(int x, int l, int r) {
  if (P <= l && r <= Q) {
    V = max(V, t[x]);
    return;
  }
  int m = l + r >> 1, t1 = x * 2, t2 = t1 + 1;
  ;
  if (d[x]) {
    t[t1] = t[t2] = t[x];
    d[t1] = d[t2] = 1;
    d[x] = 0;
  };
  if (P <= m && l <= Q) select(t1, l, m);
  if (P <= r && m < Q) select(t2, m + 1, r);
}
void paint(int x, int l, int r) {
  if (P <= l && r <= Q) {
    d[x] = 1;
    t[x] = V;
    return;
  }
  int m = l + r >> 1, t1 = x * 2, t2 = t1 + 1;
  ;
  if (d[x]) {
    t[t1] = t[t2] = t[x];
    d[t1] = d[t2] = 1;
    d[x] = 0;
  };
  if (P <= m && l <= Q) paint(t1, l, m);
  if (P <= r && m < Q) paint(t2, m + 1, r);
  t[x] = max(t[t1], t[t2]);
}
int a[100010];
int main() {
  int n, m;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    P = i, V = a[i];
    insert(1, 1, n);
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    int w, h;
    scanf("%d%d", &w, &h);
    P = 1, Q = w, V = -1;
    select(1, 1, n);
    printf("%I64d\n", V);
    V += h;
    paint(1, 1, n);
  }
  return 0;
}
