#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " = " << a << '\n';
  err(++it, args...);
}
const long long mod = 1e9 + 7;
vector<long long> seg(400005), arr(100005), lazy(400005, 0);
void build(int i, int st, int en) {
  if (st == en) {
    seg[i] = arr[st];
    return;
  }
  int mid = (st + en) >> 1, ln = i << 1, rn = ln | 1;
  build(ln, st, mid);
  build(rn, mid + 1, en);
  seg[i] = max(seg[ln], seg[rn]);
}
void update(int i, int st, int en, int l, int r, long long val) {
  int mid = (st + en) >> 1, ln = i << 1, rn = ln | 1;
  if (lazy[i] != 0) {
    seg[i] = lazy[i];
    if (st != en) lazy[ln] = lazy[rn] = lazy[i];
    lazy[i] = 0;
  }
  if (l <= st and en <= r) {
    if (st != en) lazy[ln] = lazy[rn] = val;
    seg[i] = val;
    return;
  }
  update(ln, st, mid, l, r, val);
  if (r > mid) update(rn, mid + 1, en, l, r, val);
  seg[i] = max(seg[ln], seg[rn]);
}
long long query(int i, int st, int en, int l, int r) {
  int mid = (st + en) >> 1, ln = i << 1, rn = ln | 1;
  if (lazy[i] != 0) {
    seg[i] = lazy[i];
    if (st != en) lazy[ln] = lazy[rn] = lazy[i];
    lazy[i] = 0;
  }
  if (l <= st and en <= r) return seg[i];
  long long a = query(ln, st, mid, l, r), b = 0;
  if (r > mid) b = query(rn, mid + 1, en, l, r);
  return max(a, b);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  for (__typeof(n) i = (0) - (0 > n); i != (n) - (0 > n); i += 1 - 2 * (0 > n))
    cin >> arr[i];
  build(1, 0, n - 1);
  int q;
  cin >> q;
  while (q--) {
    int w;
    long long h, ans;
    cin >> w >> h;
    ans = query(1, 0, n - 1, 0, w - 1);
    cout << ans << '\n';
    update(1, 0, n - 1, 0, w - 1, ans + h);
  }
  return 0;
}
