#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T qmin(const T &a, const T &b) {
  return a < b ? a : b;
}
template <typename T>
inline T qmax(const T &a, const T &b) {
  return a > b ? a : b;
}
template <typename T>
inline void getmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <typename T>
inline void getmax(T &a, const T &b) {
  if (a < b) a = b;
}
inline void fileio(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
const int inf = (int)1e9 + 7;
const long long linf = (long long)1e17 + 7;
const int N = 4e5 + 7;
int nums[N], sz;
long long l[N], val[N];
int n, q, cyc, g, r;
inline int lb(int x) { return lower_bound(nums + 1, nums + sz + 1, x) - nums; }
inline int ub(int x) { return upper_bound(nums + 1, nums + sz + 1, x) - nums; }
int node[N];
inline void ins(int u, int l, int r, int p, int id) {
  node[u] = id;
  if (l == r) return;
  int mid = l + r >> 1;
  if (p <= mid)
    ins(((u) << 1), l, mid, p, id);
  else
    ins(((u) << 1 ^ 1), mid + 1, r, p, id);
}
inline int getval(int u, int l, int r, int l1, int r1) {
  if (l1 > r1 || !node[u]) return n;
  if (l1 <= l && r <= r1) {
    return node[u];
  } else {
    int mid = l + r >> 1, ans = n;
    if (l1 <= mid) getmin(ans, getval(((u) << 1), l, mid, l1, r1));
    if (r1 > mid) getmin(ans, getval(((u) << 1 ^ 1), mid + 1, r, l1, r1));
    return ans;
  }
}
int main() {
  scanf("%d%d%d", &n, &g, &r), ++n;
  for (register int i = (1); i <= (n); ++i) {
    scanf("%lld", l + i);
    l[i] += l[i - 1];
  }
  cyc = g + r;
  for (register int i = (1); i <= (n); ++i) nums[++sz] = l[i] % cyc;
  sort(nums + 1, nums + sz + 1);
  sz = unique(nums + 1, nums + sz + 1) - nums - 1;
  val[n] = 0;
  for (register int i = (n)-1; i >= 0; --i) {
    ins(1, 1, sz, lb(l[i + 1] % cyc), i + 1);
    int p = l[i] % cyc, ul = (p + g) % cyc, ur = (p + g + r - 1) % cyc, q;
    if (ul <= ur)
      q = getval(1, 1, sz, lb(ul), ub(ur) - 1);
    else
      q = qmin(getval(1, 1, sz, lb(ul), sz), getval(1, 1, sz, 1, ub(ur) - 1));
    val[i] = val[q] + l[q] - l[i] + (q == n ? 0 : g + r - (l[q] - l[i]) % cyc);
  }
  scanf("%d", &q);
  while (q--) {
    int t;
    long long ans;
    scanf("%d", &t);
    int p = t % cyc;
    if (p <= g) {
      int q = getval(1, 1, sz, lb(g - p), ub(g + r - 1 - p) - 1);
      ans = t + val[q] + l[q] + (q == n ? 0 : g + r - (t + l[q]) % cyc);
    } else {
      int q = qmin(getval(1, 1, sz, 1, ub(g + r - 1 - p) - 1),
                   getval(1, 1, sz, lb(g + r - p + g), sz));
      ans = t + val[q] + l[q] + (q == n ? 0 : g + r - (t + l[q]) % cyc);
    }
    printf("%lld\n", ans);
  }
  return 0;
}
