#include <bits/stdc++.h>
using namespace std;
struct node {
  int l, r;
  long long c, maxh;
} tree[100005 << 2];
int h[100005];
void pushdown(int id) {
  if (tree[id].c) {
    tree[id << 1].c = tree[id].c;
    tree[id << 1 | 1].c = tree[id].c;
    tree[id << 1].maxh = tree[id].maxh;
    tree[id << 1 | 1].maxh = tree[id].maxh;
  }
}
void build(int id, int l, int r) {
  tree[id].l = l;
  tree[id].r = r;
  if (tree[id].l == tree[id].r) {
    tree[id].maxh = h[l];
  } else {
    int mid = (tree[id].l + tree[id].r) >> 1;
    build(id << 1, l, mid);
    build(id << 1 | 1, mid + 1, r);
    tree[id].maxh = max(tree[id << 1].maxh, tree[id << 1 | 1].maxh);
  }
}
void op(int id, int l, int r, long long c) {
  if (l <= tree[id].l && tree[id].r <= r) {
    tree[id].c = c;
    tree[id].maxh = c;
  } else {
    pushdown(id);
    int mid = (tree[id].l + tree[id].r) >> 1;
    if (l <= mid) op(id << 1, l, r, c);
    if (mid < r) op(id << 1 | 1, l, r, c);
    tree[id].maxh = max(tree[id << 1].maxh, tree[id << 1 | 1].maxh);
  }
}
long long que(int id, int l, int r) {
  if (l <= tree[id].l && tree[id].r <= r) {
    return tree[id].maxh;
  } else {
    pushdown(id);
    int mid = (tree[id].l + tree[id].r) >> 1;
    long long res = 0;
    if (l <= mid) res = max(res, que(id << 1, l, r));
    if (mid < r) res = max(res, que(id << 1 | 1, l, r));
    return res;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &h[i]);
  int m;
  scanf("%d", &m);
  build(1, 1, n);
  while (m--) {
    long long w, h;
    scanf("%I64d %I64d", &w, &h);
    long long tmp = que(1, 1, w);
    printf("%I64d\n", tmp);
    op(1, 1, w, tmp + h);
  }
  return 0;
}
