#include <bits/stdc++.h>
using namespace std;
long long data[4 * 150005], lazy[4 * 150005], ret;
int ll, rr, n, m;
void change(int t, long long d) { data[t] = lazy[t] = d; }
void down(int t) {
  if (lazy[t]) {
    change(t * 2, lazy[t]);
    change(t * 2 + 1, lazy[t]);
    lazy[t] = 0;
  }
}
void modify(int t, int l, int r) {
  if (ll <= l && r <= rr) {
    change(t, ret);
    return;
  }
  int mid = (l + r) >> 1;
  down(t);
  if (ll <= mid) modify(t * 2, l, mid);
  if (rr > mid) modify(t * 2 + 1, mid + 1, r);
  data[t] = max(data[t * 2], data[t * 2 + 1]);
}
void query(int t, int l, int r) {
  if (ll <= l && r <= rr) {
    ret = max(ret, data[t]);
    return;
  }
  int mid = (l + r) >> 1;
  down(t);
  if (ll <= mid) query(t * 2, l, mid);
  if (rr > mid) query(t * 2 + 1, mid + 1, r);
}
void build(int t, int l, int r) {
  if (l == r) {
    scanf("%I64d", &data[t]);
    return;
  }
  int mid = (l + r) >> 1;
  build(t * 2, l, mid);
  build(t * 2 + 1, mid + 1, r);
  data[t] = max(data[t * 2], data[t * 2 + 1]);
}
int main() {
  scanf("%d", &n);
  build(1, 1, n);
  scanf("%d", &m);
  while (m--) {
    int h;
    scanf("%d%d", &rr, &h);
    ll = 1;
    ret = 0;
    query(1, 1, n);
    printf("%I64d\n", ret);
    ret += h;
    modify(1, 1, n);
  }
}
