#include <bits/stdc++.h>
using namespace std;
long long a[300000], w, h;
int main() {
  int n, i, j, m;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  cin >> m;
  for (i = 1; i <= m; i++) {
    cin >> w >> h;
    long long x = max(a[1], a[w]);
    cout << x << endl;
    a[1] = x + h;
  }
  return 0;
}
