#include <bits/stdc++.h>
using namespace std;
int n, m;
const long long ninf = -1e18;
struct node {
  long long mn, lz;
  bool mark;
};
node tree[1 << 19];
void apply(int i, long long val, bool mark, int l, int r) {
  if (mark) {
    tree[i].mn = val;
    tree[i].lz = val;
    tree[i].mark = true;
  } else {
    tree[i].mn += val;
    tree[i].lz += val;
  }
}
void push(int i, int l, int mid, int r) {
  apply(2 * i, tree[i].lz, tree[i].mark, l, mid);
  apply(2 * i + 1, tree[i].lz, tree[i].mark, mid + 1, r);
  tree[i].lz = 0;
  tree[i].mark = false;
}
void update(int x, int y, long long val, bool mark, int i = 1, int l = 1,
            int r = n) {
  if (x > r || y < l) {
    return;
  }
  if (x <= l && y >= r) {
    apply(i, val, mark, l, r);
    return;
  }
  int mid = l + (r - l) / 2;
  push(i, l, mid, r);
  update(x, y, val, mark, 2 * i, l, mid);
  update(x, y, val, mark, 2 * i + 1, mid + 1, r);
  tree[i].mn = max(tree[2 * i].mn, tree[2 * i + 1].mn);
}
long long query(int x, int y, int i = 1, int l = 1, int r = n) {
  if (x > r || y < l) {
    return ninf;
  }
  if (x <= l && y >= r) {
    return tree[i].mn;
  }
  int mid = l + (r - l) / 2;
  push(i, l, mid, r);
  long long v1 = query(x, y, 2 * i, l, mid);
  long long v2 = query(x, y, 2 * i + 1, mid + 1, r);
  return max(v1, v2);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1, a; i <= n; ++i) {
    cin >> a;
    update(i, i, a, true);
  }
  cin >> m;
  while (m--) {
    int w, h;
    cin >> w >> h;
    long long mn = query(1, w);
    cout << mn << "\n";
    update(1, w, mn + h, true);
  }
}
