#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, w, h;
  cin >> n;
  long long arr[100010];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  long long m;
  cin >> m;
  long long hh = 0;
  for (long long i = 0; i < m; i++) {
    cin >> w >> h;
    if (arr[w - 1] > hh) hh = arr[w - 1];
    cout << hh << endl;
    hh += h;
  }
}
