#include <bits/stdc++.h>
using namespace std;
long long N, M, a[100007], st[400007], lazy[400007];
void build(int l, int r, int p) {
  if (l == r) {
    st[p] = a[l];
    return;
  }
  int mid = (l + r) / 2;
  build(l, mid, p * 2);
  build(mid + 1, r, p * 2 + 1);
  st[p] = max(st[p * 2], st[p * 2 + 1]);
}
void push_lazy(int l, int r, int p) {
  if (lazy[p] == 0) return;
  st[p] = lazy[p];
  if (l != r) {
    lazy[2 * p] = lazy[p];
    lazy[2 * p + 1] = lazy[p];
  } else
    a[l] = lazy[p];
  lazy[p] = 0;
}
void update(int l, int r, int p, int i, int j, long long val) {
  push_lazy(l, r, p);
  if (i > r || j < l) return;
  if (i <= l && j >= r) {
    st[p] = val;
    if (l == r)
      a[l] = val;
    else {
      lazy[p * 2] = val;
      lazy[p * 2 + 1] = val;
    }
    lazy[p] = 0;
    return;
  }
  int mid = (l + r) / 2;
  update(l, mid, p * 2, i, j, val);
  update(mid + 1, r, p * 2 + 1, i, j, val);
  st[p] = max(st[p * 2], st[p * 2 + 1]);
}
long long query(int l, int r, int p, int i, int j) {
  push_lazy(l, r, p);
  if (i > r || j < l) return -1e9 * 1e5 + 7;
  if (i <= l && j >= r) return st[p];
  int mid = (l + r) / 2;
  long long q1 = query(l, mid, p * 2, i, j);
  long long q2 = query(mid + 1, r, 2 * p + 1, i, j);
  return max(q1, q2);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> N;
  for (int i = 0; i < N; i++) cin >> a[i];
  build(0, N - 1, 1);
  cin >> M;
  for (int i = 0; i < M; i++) {
    long long idx, val;
    cin >> idx >> val;
    idx--;
    long long x = query(0, N - 1, 1, 0, idx);
    cout << x << endl;
    update(0, N - 1, 1, 0, idx, x + val);
  }
  return 0;
}
