#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 100;
long long n, a[N];
stack<pair<long long, long long> > s;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = n; i > 0; i--) s.push(pair<long long, long long>(i, a[i]));
  int m;
  long long h, w, maxi;
  pair<long long, long long> x;
  cin >> m;
  while (m--) {
    cin >> w >> h;
    maxi = 0;
    while (!s.empty()) {
      if (s.top().first > w) break;
      maxi = max(maxi, s.top().second);
      s.pop();
    }
    s.push(pair<long long, long long>(1, maxi + h));
    cout << maxi << '\n';
  }
  return 0;
}
