#include <bits/stdc++.h>
using namespace std;
int n, a[1000005], m;
int main() {
  cin >> n;
  for (int i = (1); i <= (n); i++) {
    scanf("%d", &a[i]);
  }
  cin >> m;
  int maxx = 0;
  long long maxh = a[1];
  for (int i = (1); i <= (m); i++) {
    int w, h;
    scanf("%d%d", &w, &h);
    for (int j = (maxx + 1); j <= (w); j++) {
      if (a[j] > maxh) {
        maxh = a[j];
      }
    }
    printf("%I64d\n", maxh);
    maxh = maxh + h;
    maxx = max(maxx, w);
  }
  return 0;
}
