#include <bits/stdc++.h>
using namespace std;
long long len, n, i, w, h, a[500001], mx, m;
void update(int x) {
  x /= 2;
  while (x) {
    a[x] = max(a[x * 2], a[x * 2 + 1]);
    x /= 2;
  }
}
long long get_max(int l, int r) {
  while (l <= r) {
    if (l % 2 == 1) mx = max(mx, a[l]);
    if (r % 2 == 0) mx = max(mx, a[r]);
    l = (l + 1) / 2;
    r = (r - 1) / 2;
  }
  return mx;
}
int main() {
  cin >> n;
  len = 1;
  while (len < n) len *= 2;
  for (i = 1; i <= n; i++) cin >> a[i + len - 1], update(i + len - 1);
  cin >> m;
  for (i = 1; i <= m; i++) {
    cin >> w >> h;
    a[len] = get_max(1 + len - 1, len + w - 1);
    cout << a[len] << endl;
    a[len] += h;
    update(len);
  }
  return 0;
}
