#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, pw2, a[N];
long long t[N * 4], la[N * 4];
void initst() {
  for (pw2 = 1; pw2 < n; pw2 <<= 1)
    ;
  for (int i = 0; i < n; i++) t[pw2 + i] = (long long)a[i];
  for (int i = pw2 - 1; i > 0; i--) t[i] = max(t[i * 2], t[i * 2 + 1]);
  memset(la, -1, sizeof(la));
}
void pull(int i) {
  if (la[i] == -1) return;
  t[i] = la[i];
  la[i * 2] = t[i * 2] = la[i];
  la[i * 2 + 1] = t[i * 2 + 1] = la[i];
  la[i] = -1;
}
void modify(int l, int r, long long val, int i = 1, int rangeL = 0,
            int rangeR = pw2 - 1) {
  if (rangeL != rangeR) pull(i);
  if (l <= rangeL && rangeR <= r) {
    la[i] = t[i] = val;
    return;
  }
  int mid = (rangeL + rangeR) / 2;
  if (l <= mid) modify(l, r, val, i * 2, rangeL, mid);
  if (mid < r) modify(l, r, val, i * 2 + 1, mid + 1, rangeR);
  t[i] = max(t[i * 2], t[i * 2 + 1]);
}
long long query(int l, int r, int i = 1, int rangeL = 0, int rangeR = pw2 - 1) {
  if (la[i] != -1) return la[i];
  if (l <= rangeL && rangeR <= r) {
    if (la[i] != -1)
      return la[i];
    else
      return t[i];
  }
  int mid = (rangeL + rangeR) / 2;
  long long res = 0ll;
  if (l <= mid) res = max(res, query(l, r, i * 2, rangeL, mid));
  if (mid < r) res = max(res, query(l, r, i * 2 + 1, mid + 1, rangeR));
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  initst();
  int T;
  scanf("%d", &T);
  while (T--) {
    int w, h;
    scanf("%d%d", &w, &h);
    long long ans = query(0, w - 1);
    printf("%I64d\n", ans);
    modify(0, w - 1, ans + (long long)h);
  }
  return 0;
}
