#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
struct node {
  int l, r;
  unsigned long long x;
  bool up;
};
node tree[N << 2];
void build(int l, int r, int k) {
  tree[k].l = l, tree[k].r = r, tree[k].up = false;
  if (l == r) {
    cin >> tree[k].x;
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, k << 1);
  build(mid + 1, r, k << 1 | 1);
  tree[k].x = max(tree[k << 1].x, tree[k << 1 | 1].x);
}
unsigned long long query(int l, int r, int k) {
  if (tree[k].l >= l && tree[k].r <= r) return tree[k].x;
  if (tree[k].up) {
    tree[k << 1].up = tree[k << 1 | 1].up = true;
    tree[k << 1].x = tree[k << 1 | 1].x = tree[k].x;
    tree[k].up = false;
  }
  unsigned long long a = 0, b = 0;
  if (tree[k << 1].r >= l) a = query(l, r, k << 1);
  if (tree[k << 1 | 1].l <= r) b = query(l, r, k << 1 | 1);
  return max(a, b);
}
void updata(int l, int r, int k, unsigned long long x) {
  if (tree[k].l >= l && tree[k].r <= r) {
    tree[k].x = x, tree[k].up = true;
    return;
  }
  if (tree[k << 1].r >= l) updata(l, r, k << 1, x);
  if (tree[k << 1 | 1].l <= r) updata(l, r, k << 1 | 1, x);
  tree[k].x = max(tree[k << 1].x, tree[k << 1 | 1].x);
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  while (cin >> n) {
    build(1, n, 1);
    int m;
    cin >> m;
    for (int i = 0, w, h; i < m; ++i) {
      cin >> w >> h;
      unsigned long long ans = query(1, w, 1);
      cout << ans << endl;
      updata(1, w, 1, ans + h);
    }
  }
  return 0;
}
