#include <bits/stdc++.h>
using namespace std;
void File() {
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
}
void IO() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
vector<long long> ip, TR, LZ;
long long LQ, HQ, h;
void BUILD(long long low, long long high, long long root) {
  if (low == high) {
    TR[root] = ip[high];
    return;
  }
  int mid = (low + high) / 2;
  BUILD(low, mid, 2 * root + 1);
  BUILD(mid + 1, high, 2 * root + 2);
  TR[root] = max(TR[2 * root + 1], TR[2 * root + 2]);
}
void Check_For_Updates(long long low, long long high, long long root) {
  if (LZ[root] != 0) {
    TR[root] = LZ[root];
    if (low != high) LZ[2 * root + 1] = LZ[2 * root + 2] = TR[root];
  }
  LZ[root] = 0;
}
long long Update(long long low, long long high, long long root, long long UP) {
  if (low >= LQ && HQ >= high) {
    if (low != high) {
      LZ[2 * root + 1] = LZ[2 * root + 2] = UP;
    }
    return TR[root] = UP;
  } else if (high < LQ || low > HQ)
    return LLONG_MIN;
  int mid = (low + high) / 2;
  return TR[root] = max(TR[root], max(Update(low, mid, 2 * root + 1, UP),
                                      Update(mid + 1, high, 2 * root + 2, UP)));
}
long long Query(long long low, long long high, long long root) {
  Check_For_Updates(low, high, root);
  if (low >= LQ && HQ >= high)
    return TR[root];
  else if (high < LQ || low > HQ)
    return LLONG_MIN;
  int mid = (low + high) / 2;
  return max(Query(low, mid, 2 * root + 1), Query(mid + 1, high, 2 * root + 2));
}
int main() {
  IO();
  long long n;
  cin >> n;
  ip.resize(n);
  for (int i = 0; i < n; ++i) cin >> ip[i];
  long long sz = n;
  if (double(log2(n)) - int(log2(n)) > 0) {
    long long power = 0;
    ++power += log2(n);
    sz = pow(2, power) * 2 - 1;
  } else
    sz = 2 * n - 1;
  TR.resize(sz, INT_MIN);
  LZ.resize(sz, 0);
  BUILD(0, n - 1, 0);
  long long m;
  cin >> m;
  while (m--) {
    LQ = 0;
    cin >> HQ >> h;
    HQ--;
    long long ans = Query(0, n - 1, 0);
    cout << ans << endl;
    Update(0, n - 1, 0, ans + h);
  }
  return 0;
}
