#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
long long tree[N * 4], lazy[4 * N], arr[N], n, m;
void build(int node, int l, int r) {
  if (l == r) {
    tree[node] = arr[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(node << 1, l, mid);
  build(node << 1 | 1, mid + 1, r);
  tree[node] = max(tree[node << 1], tree[node << 1 | 1]);
}
void update(int node, int l, int r, int ll, int rr, long long val) {
  if (lazy[node]) {
    tree[node] = lazy[node];
    if (l != r) {
      lazy[node << 1] = lazy[node];
      lazy[node << 1 | 1] = lazy[node];
    }
    lazy[node] = 0;
  }
  if (l > rr || r < ll) return;
  if (l >= ll && r <= rr) {
    tree[node] = val;
    lazy[node] = 0;
    if (l != r) {
      lazy[node << 1] = val;
      lazy[node << 1 | 1] = val;
    }
    return;
  }
  int mid = (l + r) >> 1;
  update(node << 1, l, mid, ll, rr, val);
  update(node << 1 | 1, mid + 1, r, ll, rr, val);
  tree[node] = max(tree[node << 1], tree[node << 1 | 1]);
}
long long query(int node, int l, int r, int ll, int rr) {
  if (lazy[node]) {
    tree[node] = lazy[node];
    if (l != r) {
      lazy[node << 1] = lazy[node];
      lazy[node << 1 | 1] = lazy[node];
    }
    lazy[node] = 0;
  }
  if (l > rr || r < ll) return 0LL;
  if (l >= ll && r <= rr) return tree[node];
  int mid = (l + r) >> 1;
  return max(query(node << 1, l, mid, ll, rr),
             query(node << 1 | 1, mid + 1, r, ll, rr));
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  build(1, 1, n);
  cin >> m;
  while (m--) {
    long long w, h;
    cin >> w >> h;
    long long x = query(1, 1, n, 1, w);
    cout << x << "\n";
    update(1, 1, n, 1, w, x + h);
  }
  return 0;
}
