#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1.0);
const long double eps = 1e-9;
deque<pair<long long, long long> > d;
int n, m;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    long long a;
    cin >> a;
    d.push_back(pair<long long, long long>(i, a));
  }
  cin >> m;
  for (long long qq = 0; qq < m; ++qq) {
    long long w, h;
    cin >> w >> h;
    long long mx = 0;
    long long last;
    while (!d.empty()) {
      if (d.front().first <= w) {
        last = d.front().second;
        mx = max(mx, d.front().second);
        d.pop_front();
      } else
        break;
    }
    cout << mx << endl;
    if (d.empty() || d.front().first > w + 1)
      d.push_front(pair<long long, long long>(w + 1, last));
    d.push_front(pair<long long, long long>(1, mx + h));
  }
}
