#include <bits/stdc++.h>
using namespace std;
long long int Tree[262167];
long long int lazy[262167];
long long int A[100007];
void createTree(int first, int last, int cur) {
  if (first == last) {
    Tree[cur] = A[first];
    return;
  }
  int mid = (first + last) / 2;
  createTree(first, mid, 2 * cur + 1);
  createTree(1 + mid, last, 2 * cur + 2);
  Tree[cur] = max(Tree[2 * cur + 1], Tree[2 * cur + 2]);
}
void update(int first, int last, int qfirst, int qlast, int cur,
            long long int val) {
  if (lazy[cur] != 0) {
    if (first != last) {
      lazy[2 * cur + 1] = lazy[cur];
      lazy[2 * cur + 2] = lazy[cur];
    }
    Tree[cur] = lazy[cur];
    lazy[cur] = 0;
  }
  if (qfirst <= first && last <= qlast) {
    Tree[cur] = val;
    if (first != last) {
      lazy[2 * cur + 1] = val;
      lazy[2 * cur + 2] = val;
    }
    return;
  }
  if (first > qlast || qfirst > last) return;
  int mid = (first + last) / 2;
  update(first, mid, qfirst, qlast, 2 * cur + 1, val);
  update(1 + mid, last, qfirst, qlast, 2 * cur + 2, val);
  Tree[cur] = max(Tree[2 * cur + 1], Tree[2 * cur + 2]);
}
long long int query(int first, int last, int qfirst, int qlast, int cur) {
  if (lazy[cur] != 0) {
    if (first != last) {
      lazy[2 * cur + 1] = lazy[cur];
      lazy[2 * cur + 2] = lazy[cur];
    }
    Tree[cur] = lazy[cur];
    lazy[cur] = 0;
  }
  if (qfirst <= first && last <= qlast) return Tree[cur];
  if (first > qlast || qfirst > last) return LLONG_MIN;
  int mid = (first + last) / 2;
  return max(query(first, mid, qfirst, qlast, 2 * cur + 1),
             query(1 + mid, last, qfirst, qlast, 2 * cur + 2));
}
int main() {
  int i, j, k, l, m, n, w;
  long long int temp, h;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%lld", &A[i]);
  }
  createTree(0, n - 1, 0);
  scanf("%d", &m);
  while (m--) {
    scanf("%d", &w);
    scanf("%lld", &h);
    temp = query(0, n - 1, 0, w - 1, 0);
    printf("%lld\n", temp);
    update(0, n - 1, 0, w - 1, 0, h + temp);
  }
  return 0;
}
