#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:512000000")
template <class T>
T sqr(T a) {
  return a * a;
}
long long a[1 << 17];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  int m;
  scanf("%d", &m);
  int k = 0;
  long long curh = 0;
  for (int i = 0; i < m; ++i) {
    int w, h;
    scanf("%d%d", &w, &h);
    for (int j = k; j < w; ++j) curh = max(curh, a[j]);
    k = w;
    printf("%I64d\n", curh);
    curh += h;
  }
  return 0;
}
