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