#include <bits/stdc++.h>
using namespace std;
int N, M;
long long H, W, Aint[4 * 100010], V[100010];
bool Upd[4 * 100010];
void Build(int Node, int Left, int Right) {
  Upd[Node] = 0;
  if (Left == Right) {
    Aint[Node] = V[Left];
    return;
  }
  int Mid = (Left + Right) / 2;
  Build((2 * Node), Left, Mid);
  Build((2 * Node + 1), Mid + 1, Right);
  Aint[Node] = max(Aint[(2 * Node)], Aint[(2 * Node + 1)]);
}
void Update(int Node, int Left, int Right, int LeftBound, int RightBound,
            long long Val) {
  if (LeftBound <= Left && Right <= RightBound) {
    Aint[Node] = Val;
    Upd[Node] = 1;
    return;
  }
  int Mid = (Left + Right) / 2;
  if (LeftBound <= Mid)
    Update((2 * Node), Left, Mid, LeftBound, RightBound, Val);
  if (Mid < RightBound)
    Update((2 * Node + 1), Mid + 1, Right, LeftBound, RightBound, Val);
  Aint[Node] = max(Aint[(2 * Node)], Aint[(2 * Node + 1)]);
}
long long Query(int Node, int Left, int Right, int LeftBound, int RightBound) {
  if (LeftBound <= Left && Right <= RightBound) return Aint[Node];
  int Mid = (Left + Right) / 2;
  long long Ans = 0;
  if (Upd[Node]) {
    Update((2 * Node), Left, Mid, Left, Mid, Aint[Node]);
    Update((2 * Node + 1), Mid + 1, Right, Mid + 1, Right, Aint[Node]);
    Upd[Node] = 0;
  }
  if (LeftBound <= Mid)
    Ans = max(Ans, Query((2 * Node), Left, Mid, LeftBound, RightBound));
  if (Mid < RightBound)
    Ans =
        max(Ans, Query((2 * Node + 1), Mid + 1, Right, LeftBound, RightBound));
  return Ans;
}
int main() {
  scanf("%i", &N);
  for (int i = 1; i <= N; ++i) scanf("%i", &V[i]);
  Build(1, 1, N);
  scanf("%i", &M);
  for (int i = 1; i <= M; ++i) {
    scanf("%I64d %I64d", &W, &H);
    long long Ans = Query(1, 1, N, 1, W);
    printf("%I64d\n", Ans);
    Update(1, 1, N, 1, W, Ans + H);
  }
  return 0;
}
