#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int n, m;
int a[MAXN];
int w[MAXN], h[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &w[i], &h[i]);
  }
  long long lasth = 0;
  for (int i = 1; i <= m; i++) {
    long long int x = lasth + 1;
    if (a[w[i]] > x) x = a[w[i]];
    printf("%I64d\n", x);
    lasth = x + h[i] - 1;
  }
  return 0;
}
