#include <bits/stdc++.h>
using namespace std;
long long n, a[100010], w[100010], h[100010], c[100010], m;
long long lowbit(long long x) { return x & -x; }
void update(long long p, long long v) {
  for (; p <= n; p += lowbit(p)) {
    c[p] = max(c[p], v);
  }
}
long long get_max(long long p) {
  long long ans = -0x3f3f3f3f;
  for (; p; p -= lowbit(p)) {
    ans = max(ans, c[p]);
  }
  return ans;
}
int main() {
  while (scanf("%I64d", &n) != EOF) {
    for (long long i = 1; i <= n; ++i) scanf("%I64d", &a[i]);
    scanf("%I64d", &m);
    for (long long i = 0; i < m; ++i) {
      scanf("%I64d%I64d", &w[i], &h[i]);
    }
    for (long long i = 0; i <= n; ++i) c[i] = -0x3f3f3f3f;
    for (long long i = 1; i <= n; ++i) update(i, a[i]);
    for (long long i = 0; i < m; ++i) {
      long long ans = get_max(w[i]);
      printf("%I64d\n", ans);
      update(1, ans + h[i]);
    }
  }
  return 0;
}
