#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int m;
  cin >> m;
  long long basewidth = 1;
  long long baseheight = a[0];
  for (int i = 0; i < m; i++) {
    long long w, h;
    cin >> w >> h;
    if (w <= basewidth) {
      cout << baseheight << endl;
      baseheight += h;
      for (int j = basewidth - 1; j < n; j++) {
        basewidth = j + 1;
        if (a[j] > baseheight) {
          basewidth--;
          break;
        }
      }
    } else {
      for (int j = basewidth; j <= n; j++) {
        basewidth = j;
        if (j >= w) {
          cout << a[j - 1] << endl;
          baseheight = a[j - 1] + h;
          for (int k = basewidth - 1; k < n; k++) {
            basewidth = k + 1;
            if (a[k] > baseheight) {
              basewidth--;
              break;
            }
          }
          break;
        }
      }
    }
  }
  return 0;
}
