#include <bits/stdc++.h>
int main() {
  int numStairs;
  int numBoxes;
  std::cin >> numStairs;
  std::vector<int> stairs(numStairs);
  for (int i = 0; i < numStairs; i++) {
    std::cin >> stairs[i];
  }
  std::cin >> numBoxes;
  std::vector<std::pair<int, int> > boxes(numBoxes);
  for (int i = 0; i < numBoxes; i++) {
    int w, h;
    std::cin >> w >> h;
    boxes[i] = std::make_pair(w, h);
  }
  long long heightOfStair;
  long long heightOfBoxes = 0;
  for (int i = 0; i < numBoxes; i++) {
    heightOfStair = stairs[boxes[i].first - 1];
    long long bottom = std::max(heightOfStair, heightOfBoxes);
    std::cout << bottom << std::endl;
    heightOfBoxes += boxes[i].second;
    if (bottom == heightOfStair)
      heightOfBoxes = heightOfStair + boxes[i].second;
  }
}
