#include <bits/stdc++.h>
using namespace std;
inline void q_read(long long &num) {
  long long f = 1;
  char ch;
  while (true) {
    ch = getchar();
    if (ch == '-') f = -1;
    if (isdigit(ch)) {
      num = (long long)(ch - '0');
      break;
    }
  }
  while (ch = getchar(), isdigit(ch)) num = num * 10ll + ch - '0';
  num *= f;
}
long long a[2000009];
int main() {
  long long n, m, w, h;
  q_read(n);
  for (int i = 1; i <= n; i++) q_read(a[i]);
  q_read(m);
  long long k = 0;
  long long s = 1;
  while (m--) {
    q_read(w);
    q_read(h);
    for (int i = s; i <= w; i++) k = max(k, a[i]);
    printf("%I64d\n", k);
    k = k + h;
    s = max(s, w);
  }
  return 0;
}
