#include <bits/stdc++.h>
using namespace std;
const int MAX = 100200;
long long int t, a[MAX], h[MAX];
int n, m, pt, w[MAX];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  cin >> m;
  for (int i = 1; i <= m; i++) cin >> w[i] >> h[i];
  t = 0LL;
  pt = 0;
  for (int i = 1; i <= m; i++) {
    cout << max(t, a[w[i]]) << '\n';
    t = h[i] + max(a[w[i]], t);
    continue;
    if (w[i] <= pt) {
      cout << t << '\n';
      t += h[i];
    } else {
      cout << a[w[i]] << '\n';
      t = a[w[i]] + h[i];
      pt = w[i];
    }
  }
  return 0;
}
