#include <bits/stdc++.h>
using namespace std;
const int MXN = 100010;
int N, Q;
int A[MXN], W[MXN], H[MXN];
pair<long long, int> P[MXN];
void init() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++)
    scanf("%d", A + i), P[i] = pair<int, int>(A[i], i);
  scanf("%d", &Q);
  for (int i = 1; i <= Q; i++) scanf("%d%d", W + i, H + i);
}
namespace solve {
long long ans[MXN];
void solve() {
  int p = 1;
  for (int iq = 1; iq <= Q; iq++) {
    while (p <= N && P[p].second <= W[iq]) {
      ans[iq] = P[p].first;
      p++;
    }
    P[0] = pair<long long, int>(ans[iq] + H[iq], 1);
    while (p <= N && P[p] < P[0]) p++;
    P[--p] = P[0];
  }
  for (int i = 1; i <= Q; i++) printf("%I64d\n", ans[i]);
}
}  // namespace solve
int main() {
  init();
  solve::solve();
  return 0;
}
