#include <bits/stdc++.h>
using namespace std;
int i, j, n, m, pos, c;
long long sum, mx;
int root;
int w, h;
int l, r;
long long a[200001], d[200001];
bool boo[200001];
void decom() {
  root = int(sqrt(n));
  c = 1;
  for (i = 1; i <= n; i++) {
    d[c] = max(d[c], a[i]);
    if (i % root == 0) c++;
  }
}
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  decom();
  cin >> m;
  for (i = 1; i <= m; i++) {
    cin >> w >> h;
    j = 1;
    sum = root;
    mx = 0;
    while (sum < w) {
      mx = max(mx, d[j]);
      j++;
      sum += root;
    }
    pos = j - 1;
    l = sum - root + 1;
    r = w;
    if (boo[pos + 1])
      mx = max(d[pos + 1], mx);
    else
      for (j = l; j <= r; j++) mx = max(mx, a[j]);
    cout << mx << endl;
    for (j = pos; j >= 1; j--) {
      d[j] = mx + h;
      boo[j] = true;
    }
    if (boo[pos + 1]) {
      for (j = r + 1; j <= sum; j++) a[j] = d[pos + 1];
      boo[pos + 1] = false;
    }
    for (j = l; j <= r; j++) a[j] = mx + h;
    if (d[pos + 1] < mx + h) d[pos + 1] = mx + h;
  }
  return 0;
}
