#include <bits/stdc++.h>
using namespace std;
int gcd(int m, int n) {
  int r;
  while (n != 0) {
    r = m % n;
    m = n;
    n = r;
  }
  return m;
}
int main() {
  long long int n;
  cin >> n;
  long long int a[n + 1];
  for (long long int i = 1; i <= n; i++) cin >> a[i];
  long long int q;
  cin >> q;
  long long int mx = 0;
  long long int height = 0;
  while (q--) {
    long long int w, h;
    cin >> w >> h;
    if (mx < w) {
      mx = w;
      int mm = max(height, a[w]);
      cout << mm << endl;
      height = mm + h;
    } else {
      cout << height << endl;
      height += h;
    }
  }
  return 0;
}
