#include <bits/stdc++.h>
using namespace std;
long long tree[4 * 100001];
long long lazy[4 * 100001];
long long a[100001];
void build(int l, int r, int node) {
  if (l > r) return;
  if (l == r) {
    tree[node] = a[l];
    return;
  }
  int mid = (l + r) / 2;
  build(l, mid, 2 * node);
  build(mid + 1, r, 2 * node + 1);
  tree[node] = max(tree[2 * node], tree[2 * node + 1]);
}
void update(int l, int r, int low, int high, long long val, int node) {
  if (lazy[node] != 0) {
    tree[node] = lazy[node];
    if (l != r) {
      lazy[2 * node] = lazy[node];
      lazy[2 * node + 1] = lazy[node];
    }
    lazy[node] = 0;
  }
  if (r < low || l > high) {
    return;
  }
  if (low <= l && r <= high) {
    tree[node] = val;
    if (l != r) {
      lazy[2 * node] = val;
      lazy[2 * node + 1] = val;
    }
    return;
  }
  int mid = (l + r) / 2;
  update(l, mid, low, high, val, 2 * node);
  update(mid + 1, r, low, high, val, 2 * node + 1);
  tree[node] = max(tree[2 * node], tree[2 * node + 1]);
}
long long query(int l, int r, int low, int high, int node) {
  if (lazy[node] != 0) {
    tree[node] = lazy[node];
    if (l != r) {
      lazy[2 * node] = lazy[node];
      lazy[2 * node + 1] = lazy[node];
    }
    lazy[node] = 0;
  }
  if (r < low || l > high) return -1;
  if (low <= l && r <= high) {
    return tree[node];
  }
  int mid = (l + r) / 2;
  return max(query(l, mid, low, high, 2 * node),
             query(mid + 1, r, low, high, 2 * node + 1));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  build(1, n, 1);
  long long m;
  cin >> m;
  vector<long long> v;
  while (m--) {
    long long w, h;
    cin >> w >> h;
    long long ans = query(1, n, 1, w, 1);
    v.push_back(ans);
    update(1, n, 1, w, ans + h, 1);
  }
  for (int i = 0; i < v.size(); i++) cout << v[i] << endl;
  return 0;
}
