#include <bits/stdc++.h>
using namespace std;
int getint() {
  int ret = 0;
  bool ok = false;
  for (;;) {
    int c = getchar();
    if (c >= '0' && c <= '9')
      ret = (ret << 3) + ret + ret + c - '0', ok = true;
    else if (ok)
      return ret;
  }
}
int n;
int l[100010];
long long s[100010], p, t[100010];
int g, r;
long long tmp[100010], val[100010];
int N;
int M = 1, T[1 << 18];
const int inf = 0x7f7f7f7f;
void modify(int i, int x) {
  for (i += M; i; i >>= 1)
    if (x < T[i]) T[i] = x;
}
int query(int l, int r) {
  if (l > r) return inf;
  int ret = inf;
  for (l += M - 1, r += M + 1; l ^ r ^ 1; l >>= 1, r >>= 1) {
    if (~l & 1) ret = min(ret, T[l + 1]);
    if (r & 1) ret = min(ret, T[r - 1]);
  }
  return ret;
}
int getpos(long long x) { return lower_bound(val + 1, val + N + 1, x) - val; }
int findnext(int i) {
  return min(query(getpos(g + s[i] % p), N),
             query(getpos(g - p + s[i] % p), getpos(s[i] % p) - 1));
}
int _findnext(long long x) {
  return min(query(getpos(g - x % p), getpos(p - x % p) - 1),
             query(getpos(g + p - x % p), N));
}
int main() {
  n = getint(), g = getint(), r = getint(), p = (long long)g + r;
  for (int i = 1; i <= n + 1; i++) l[i] = getint(), s[i] = s[i - 1] + l[i];
  for (int i = 0; i <= n + 1; i++) tmp[i] = s[i] % p;
  sort(tmp, tmp + n + 2);
  N = 1, val[1] = tmp[0];
  for (int i = 1; i <= n + 1; i++)
    if (tmp[i] != val[N]) val[++N] = tmp[i];
  while (M - 2 < N) M <<= 1;
  memset(T, 0x7f, sizeof(T));
  for (int i = n; i >= 0; i--) {
    int j = findnext(i);
    if (j == inf)
      t[i] = s[n + 1] - s[i];
    else
      t[i] = t[j] + s[j] - s[i] + p - (s[j] - s[i]) % p;
    if (i) modify(getpos(s[i] % p), i);
  }
  int Q = getint();
  while (Q--) {
    int x = getint();
    int i = _findnext(x);
    if (i == inf)
      printf("%I64d\n", x + s[n + 1]);
    else
      printf("%I64d\n", x + s[i] + t[i] + p - (x + s[i]) % p);
  }
  return 0;
}
