#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int WHITE = 0, GRAY = 1, BLACK = 2, GREEN = 3, BLUE = 4;
const int LIM = 1e+6, LIM1 = 1e+3;
const long long INF = 1e+9, MOD = 1e+9 + 7;
const double PI = 3.141592653589793, EPS = 1e-7;
long long n, m, a[LIM], t[LIM], add[LIM];
void build_tree(long long u, long long t_l, long long t_r) {
  if (t_r - t_l > 1) {
    long long t_m = (t_l + t_r) / 2;
    build_tree(2 * u, t_l, t_m);
    build_tree(2 * u + 1, t_m, t_r);
    t[u] = max(t[u * 2], t[u * 2 + 1]);
  } else {
    t[u] = a[t_l];
  }
}
void push(long long u) {
  if (add[u] != 0) {
    add[2 * u] = add[u];
    add[2 * u + 1] = add[u];
    t[u] = add[u];
    add[u] = 0;
  }
}
void upd(long long u) { t[u] = max(t[u], max(t[u * 2], t[u * 2 + 1])); }
void eq(long long u, long long t_l, long long t_r, long long l, long long r,
        long long p) {
  push(u);
  if (t_l == l && t_r == r) {
    add[u] = p;
  } else {
    long long t_m = (t_l + t_r) / 2;
    if (r <= t_m) {
      eq(2 * u, t_l, t_m, l, r, p);
    } else if (l >= t_m) {
      eq(2 * u + 1, t_m, t_r, l, r, p);
    } else {
      eq(2 * u, t_l, t_m, l, t_m, p);
      eq(2 * u + 1, t_m, t_r, t_m, r, p);
    }
  }
  push(u);
  upd(u);
}
long long get_max(long long u, long long t_l, long long t_r, long long l,
                  long long r) {
  push(u);
  upd(u);
  if (t_l == l && t_r == r) {
    return t[u];
  }
  long long t_m = (t_l + t_r) / 2;
  if (r <= t_m) {
    return get_max(2 * u, t_l, t_m, l, r);
  } else if (l >= t_m) {
    return get_max(2 * u + 1, t_m, t_r, l, r);
  } else {
    return max(get_max(2 * u, t_l, t_m, l, t_m),
               get_max(2 * u + 1, t_m, t_r, t_m, r));
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  build_tree(1, 0, n);
  cin >> m;
  for (long long i = 0; i < m; i++) {
    long long w, h;
    cin >> w >> h;
    long long mx = get_max(1, 0, n, 0, w);
    eq(1, 0, n, 0, w, mx + h);
    cout << mx << '\n';
  }
  return 0;
}
