#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
inline void read(int &x) {
  x = 0;
  char c = getchar();
  int f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = 10 * x + c - '0';
    c = getchar();
  }
  x *= f;
}
void printDouble(double x, int n) {
  cout << fixed << setprecision(n);
  cout << x << endl;
}
int main() {
  int n, m, w, h;
  cin >> n;
  long long hMax(0);
  vector<int> heigth(n + 1, 0);
  for (int i = 1; i <= n; i++) read(heigth[i]);
  cin >> m;
  for (int i = 1; i <= m; i++) {
    read(w);
    read(h);
    hMax = max(hMax, heigth[w] * 1ll);
    cout << hMax << " ";
    hMax += h;
  }
}
