#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
struct node {
  int l, r;
  long long tag, val;
} tree[maxn << 2];
int h[maxn];
void pushdown(int pos) {
  if (tree[pos].tag) {
    tree[pos << 1].tag = tree[pos].tag;
    tree[pos << 1 | 1].tag = tree[pos].tag;
    tree[pos << 1].val = tree[pos].val;
    tree[pos << 1 | 1].val = tree[pos].val;
  }
}
void build(int l, int r, int pos) {
  tree[pos].l = l;
  tree[pos].r = r;
  if (tree[pos].l == tree[pos].r) {
    tree[pos].val = h[l];
    return;
  }
  int mid = (tree[pos].l + tree[pos].r) >> 1;
  build(l, mid, pos << 1);
  build(mid + 1, r, pos << 1 | 1);
  tree[pos].val = max(tree[pos << 1].val, tree[pos << 1 | 1].val);
}
void update(int l, int r, long long tag, int pos) {
  if (l <= tree[pos].l && tree[pos].r <= r) {
    tree[pos].tag = tag;
    tree[pos].val = tag;
    return;
  }
  pushdown(pos);
  int mid = (tree[pos].l + tree[pos].r) >> 1;
  if (l <= mid) update(l, r, tag, pos << 1);
  if (mid < r) update(l, r, tag, pos << 1 | 1);
  tree[pos].val = max(tree[pos << 1].val, tree[pos << 1 | 1].val);
}
long long query(int l, int r, int pos) {
  if (l <= tree[pos].l && tree[pos].r <= r) {
    return tree[pos].val;
  }
  pushdown(pos);
  int mid = (tree[pos].l + tree[pos].r) >> 1;
  long long ans = 0;
  if (l <= mid) ans = max(ans, query(l, r, pos << 1));
  if (mid < r) ans = max(ans, query(l, r, pos << 1 | 1));
  return ans;
}
int main() {
  int n, m;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &h[i]);
  scanf("%d", &m);
  build(1, n, 1);
  while (m--) {
    long long w, h;
    scanf("%I64d%I64d", &w, &h);
    long long tmp = query(1, w, 1);
    printf("%I64d\n", tmp);
    update(1, w, tmp + h, 1);
  }
}
