#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200001;
const int MAXX = 1e6 + 7;
int a[MAXN];
int ans[MAXX];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, x, y;
  cin >> n >> x >> y;
  for (int i = 0; i <= n; i++) cin >> a[i];
  bitset<MAXN> total;
  bitset<MAXN> pre;
  for (int i = 0; i < n; i++) {
    pre.set(0, 1);
    pre <<= a[i + 1] - a[i];
    total |= pre;
  }
  memset(ans, -1, sizeof ans);
  for (int i = x; i > 0; i--) {
    if (total.test(i) == 0) continue;
    int p = (y + i) * 2;
    for (int j = p; j < MAXX; j += p) {
      if (ans[j] != -1) continue;
      ans[j] = p;
    }
  }
  int q;
  cin >> q;
  while (q--) {
    int x;
    cin >> x;
    cout << ans[x] << " ";
  }
  return 0;
}
