#include <bits/stdc++.h>
using namespace std;
template <typename typ>
void vout(vector<typ>& v) {
  for (int vint = 0; vint < (int)(v).size(); vint++) cout << (v)[vint] << ' ';
  cout << endl;
}
template <typename typ>
void arrout(typ* arr, int l) {
  for (int i = 0; i < l; i++) cout << arr[i] << ' ';
  cout << endl;
}
int main() {
  int n, m;
  cin >> n;
  long long a[n + 1];
  for (int i = 1; i <= n; ++i) cin >> a[i];
  int w, h;
  cin >> m;
  long long H = 0;
  for (int i = 0; i < m; ++i) {
    cin >> w >> h;
    cout << (max(a[w], H)) << endl;
    H = max(a[w], H) + (long long)h;
  }
}
