#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
long long N = 1e6;
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long m, maxi = 0;
  cin >> m;
  while (m--) {
    long long w, h;
    cin >> w >> h;
    maxi = max(maxi, a[w - 1]);
    cout << maxi << " ";
    maxi += h;
  }
}
