#include <bits/stdc++.h>
using namespace std;
long long tree[400044];
vector<long long> Max(400044, -1);
void init(int v, int l, int r, long long *arr) {
  if (l == r)
    tree[v] = arr[l];
  else {
    int m = (l + r) / 2;
    init(v * 2, l, m, arr);
    init(v * 2 + 1, m + 1, r, arr);
    tree[v] = max(tree[v * 2], tree[v * 2 + 1]);
  }
}
void push(int v, bool isEnd) {
  if (Max[v] != -1) {
    tree[v] = max(tree[v], Max[v]);
    if (!isEnd) {
      tree[v * 2] = max(tree[v * 2], Max[v]);
      tree[v * 2 + 1] = max(tree[v * 2 + 1], Max[v]);
      Max[v * 2 + 1] = max(Max[v * 2 + 1], Max[v]);
      Max[v * 2] = max(Max[v * 2], Max[v]);
    }
    Max[v] = -1;
  }
}
void update(int v, long long val, int l, int r, int L, int R) {
  if (l > r)
    return;
  else if (l == L && r == R) {
    Max[v] = val;
    push(v, (l == r));
  } else {
    push(v, false);
    int m = (L + R) / 2;
    update(v * 2, val, l, min(m, r), L, m);
    update(v * 2 + 1, val, max(m + 1, l), r, m + 1, R);
    tree[v] = max(tree[v * 2], tree[v * 2 + 1]);
  }
}
long long getMax(int v, int l, int r, int L, int R) {
  if (l > r)
    return -1;
  else if (l == L && r == R) {
    push(v, (l == r));
    return tree[v];
  } else {
    push(v, false);
    int m = (L + R) / 2;
    return (max(getMax(v * 2, l, min(m, r), L, m),
                getMax(v * 2 + 1, max(m + 1, l), r, m + 1, R)));
  }
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  long long *arr = new long long[n];
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  init(1, 0, n - 1, arr);
  int m;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    int w, h;
    cin >> w >> h;
    long long Max = getMax(1, 0, w - 1, 0, n - 1);
    cout << Max << endl;
    update(1, Max + h, 0, w - 1, 0, n - 1);
  }
  return 0;
}
