#include <bits/stdc++.h>
int a[111111], n, m, w, h, cur;
long long ans;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  scanf("%d", &m);
  cur = 0;
  ans = 0;
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &w, &h);
    for (int j = cur; j < w; ++j) {
      if (a[j] > ans) ans = a[j];
    }
    printf("%I64d\n", ans);
    ans += h;
    if (w > cur) cur = w;
  }
  return 0;
}
