#include <bits/stdc++.h>
using namespace std;
const int MaxN = 400500;
long long a[MaxN], leftt[MaxN], rightt[MaxN], n;
struct it {
  long long max, val;
};
it tree[MaxN];
void push(long long i) {
  if (tree[i].val != 0) {
    tree[i * 2].val = tree[i].val;
    tree[i * 2 + 1].val = tree[i].val;
    tree[i * 2].max = tree[i].val;
    tree[i * 2 + 1].max = tree[i].val;
    tree[i].val = 0;
  }
}
void create(long long i, long long l, long long r) {
  if (l == r) {
    tree[i].max = a[l];
    tree[i].val = a[l];
    leftt[i] = l;
    rightt[i] = r;
  } else {
    leftt[i] = l;
    rightt[i] = r;
    int m = (l + r) / 2;
    create(2 * i, l, m);
    create(2 * i + 1, m + 1, r);
    tree[i].max = max(tree[i * 2].max, tree[2 * i + 1].max);
    tree[i].val = 0;
  }
}
long long getAns(long long i, long long l, long long r) {
  long long ans = 0;
  if ((leftt[i] >= l) && (rightt[i] <= r)) {
    return tree[i].max;
  }
  if ((leftt[i] > r) || (rightt[i] < l)) {
    return -1;
  }
  push(i);
  int m = (l + r) / 2;
  ans = max(getAns(2 * i, l, r), getAns(2 * i + 1, l, r));
  return ans;
}
void update(long long i, long long l, long long r, long long x) {
  if ((l > rightt[i]) || (r < leftt[i])) {
    return;
  }
  if ((l <= leftt[i]) && (r >= rightt[i])) {
    tree[i].val = x;
    tree[i].max = x;
    return;
  }
  push(i);
  update(2 * i, l, r, x);
  update(2 * i + 1, l, r, x);
  tree[i].max = max(tree[i * 2].max, tree[i * 2 + 1].max);
  tree[i].val = 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  long long i, k, l, r, x, w, h, cur, m;
  char c;
  for (i = 0; i < MaxN; i++) {
    a[i] = 0;
    tree[i].max = -1;
    tree[i].val = -1;
    leftt[i] = 0;
    rightt[i] = 0;
  }
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  create(1, 1, 131071);
  cin >> m;
  for (i = 0; i < m; i++) {
    cin >> w >> h;
    cur = getAns(1, 1, w);
    cout << cur << endl;
    update(1, 1, w, cur + h);
  }
  cin.get();
  cin.get();
}
