#include <bits/stdc++.h>
int a, b, c, m[100000];
bool bi[100000];
using namespace std;
vector<int> r;
int main() {
  priority_queue<long long, vector<long long>> be;
  cin >> a;
  for (int i = 0; i < a; ++i) cin >> m[i];
  cin >> b;
  for (int i = 0; i < b; ++i) {
    int t, tr;
    cin >> t >> tr;
    t--;
    int max = 0;
    if (!bi[t]) {
      for (int i = t; i >= 0; --i) {
        if (bi[i]) {
          if (be.top() > max) max = be.top();
          be.push(max + tr);
          break;
        }
        if (m[i] > max) max = m[i];
      }
      be.push(max + tr);
      for (int i = 0; i <= t; ++i) bi[i] = 1;
    } else {
      be.push(be.top() + tr);
    }
    cout << be.top() - tr << endl;
  }
}
