#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
const int M = 1000000007;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int n, x, y;
  cin >> n >> x >> y;
  ++n;
  vector<int> a(n);
  bitset<200010> bs;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    bs[a[i]] = true;
  }
  bitset<200010> exi = bs;
  for (int i = 0; i + 1 < n; ++i) {
    bs >>= a[i + 1] - a[i];
    exi |= bs;
  }
  int lim = 500010;
  vector<int> ans(lim, -1);
  for (int i = 1; i < 200010; ++i) {
    if (exi[i]) {
      for (int j = i + y; j < lim; j += i + y) {
        ans[j] = (i + y) * 2;
      }
    }
  }
  int q;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    int l;
    cin >> l;
    cout << ans[l / 2] << (i < q - 1 ? ' ' : '\n');
  }
  return 0;
}
