#include <bits/stdc++.h>
using namespace std;
long long n, st[(long long)1e6], v[(long long)1e6], lazy[(long long)1e6], val,
    m;
void propagate(long long curr) {
  if (lazy[curr]) {
    st[curr] = lazy[curr];
    lazy[curr * 2] = lazy[curr];
    lazy[curr * 2 + 1] = lazy[curr];
    lazy[curr] = 0;
  }
}
void build(long long l = 0, long long r = n - 1, long long curr = 1) {
  if (l == r) {
    st[curr] = v[l];
    return;
  }
  build(l, (l + r) / 2, 2 * curr);
  build((l + r) / 2 + 1, r, 2 * curr + 1);
  st[curr] = max(st[curr * 2 + 1], st[2 * curr]);
}
void update(long long x, long long y, long long l = 0, long long r = n - 1,
            long long curr = 1) {
  propagate(curr);
  if (x == l && y == r) {
    lazy[curr] = val;
    propagate(curr);
    return;
  }
  long long mid = (l + r) / 2;
  if (y <= mid) {
    update(x, y, l, mid, 2 * curr);
  } else if (x > mid) {
    update(x, y, mid + 1, r, 2 * curr + 1);
  } else {
    update(x, mid, l, mid, 2 * curr);
    update(mid + 1, y, mid + 1, r, 2 * curr + 1);
  }
  propagate(curr);
  propagate(curr * 2);
  propagate(curr * 2 + 1);
  st[curr] = max(st[curr * 2 + 1], st[2 * curr]);
}
long long query(long long x, long long y, long long l = 0, long long r = n - 1,
                long long curr = 1) {
  propagate(curr);
  if (x == l && y == r) {
    return st[curr];
  }
  long long mid = (l + r) / 2;
  if (y <= mid) {
    return query(x, y, l, mid, 2 * curr);
  }
  if (x > mid) {
    return query(x, y, mid + 1, r, 2 * curr + 1);
  }
  return max(query(x, mid, l, mid, 2 * curr),
             query(mid + 1, y, mid + 1, r, 2 * curr + 1));
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> v[i];
  build();
  cin >> m;
  while (m--) {
    long long x, y;
    cin >> x >> y;
    long long p = query(0, x - 1);
    cout << p << endl;
    val = y + p;
    update(0, x - 1);
  }
}
