#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int at;
pair<long long, long long> st[MAXN];
void insert(long long a, long long b) {
  while (at && st[at].first <= a) at--;
  st[++at] = pair<long long, long long>(a, b);
}
void find(long long a, long long b) {
  long long r = 0;
  while (at && st[at].second <= a) {
    r = max(r, st[at].first);
    at--;
  }
  cout << r << endl;
  r += b;
  while (at && st[at].first <= r) at--;
  st[++at] = pair<long long, long long>(r, 1);
}
long long ar[MAXN];
int main() {
  int n;
  scanf(" %d", &n);
  for (int(i) = (0); (i) < (n); (i)++) cin >> ar[i];
  ar[n] = 1e12;
  for (int(i) = (n); (i) >= (0); (i)--) insert(ar[i], (long long)i + 1);
  int m;
  long long a, b;
  scanf(" %d", &m);
  for (int(i) = (0); (i) < (m); (i)++) {
    cin >> a >> b;
    find(a, b);
  }
  return 0;
}
