#include <bits/stdc++.h>
using namespace std;
const int maxint = -1u >> 1;
const int maxn = 100010;
long long Max[maxn << 2], col[maxn << 2];
int n, m;
void Pushup(int rt) { Max[rt] = max(Max[rt << 1], Max[rt << 1 | 1]); }
void Build(int l, int r, int rt) {
  if (l == r) {
    scanf("%I64d", &Max[rt]);
    return;
  }
  int m = (l + r) >> 1;
  Build(l, m, rt << 1);
  Build(m + 1, r, rt << 1 | 1);
  Pushup(rt);
}
void Pushdown(int rt) {
  if (col[rt] == 0) return;
  Max[rt << 1] = col[rt << 1] = col[rt];
  Max[rt << 1 | 1] = col[rt << 1 | 1] = col[rt];
  col[rt] = 0;
}
long long Query(int l, int r, int rt, int L, int R) {
  if (L <= l && r <= R) {
    return Max[rt];
  }
  Pushdown(rt);
  int m = (l + r) >> 1;
  long long ret = 0;
  if (L <= m) ret = max(ret, Query(l, m, rt << 1, L, R));
  if (R > m) ret = max(ret, Query(m + 1, r, rt << 1 | 1, L, R));
  return ret;
}
void Update(int l, int r, int rt, int L, int R, long long h) {
  if (L <= l && r <= R) {
    Max[rt] = h;
    col[rt] = h;
    return;
  }
  Pushdown(rt);
  int m = (l + r) >> 1;
  if (L <= m) Update(l, m, rt << 1, L, R, h);
  if (R > m) Update(m + 1, r, rt << 1 | 1, L, R, h);
  Pushup(rt);
}
int main() {
  scanf("%d", &n);
  Build(1, n, 1);
  scanf("%d", &m);
  long long tmp, w, h;
  while (m--) {
    scanf("%I64d%I64d", &w, &h);
    tmp = Query(1, n, 1, 1, w);
    printf("%I64d\n", tmp);
    Update(1, n, 1, 1, w, tmp + h);
  }
  return 0;
}
