#include <bits/stdc++.h>
using namespace std;
int mn[200005], app[100005], cnt;
long long sum[100005], dp[100005];
inline int query(int l, int r) {
  int res = 0x3f3f3f3f;
  for (l += cnt, r += cnt; l < r; l >>= 1, r >>= 1) {
    if (l & 1) res = min(res, mn[l++]);
    if (r & 1) res = min(res, mn[--r]);
  }
  return res;
}
inline void modify(int pos, int x) {
  for (mn[pos += cnt] = x; pos; pos >>= 1)
    mn[pos >> 1] = min(mn[pos], mn[pos ^ 1]);
}
inline int calc(int l, int r) {
  int L = lower_bound(app, app + cnt, l) - app;
  if (L >= cnt) return 0x3f3f3f3f;
  int R = lower_bound(app, app + cnt, r) - app;
  if (R >= cnt || app[R] != r) R--;
  if (L > R) return 0x3f3f3f3f;
  return query(L, R + 1);
}
int main() {
  int n, g, r;
  scanf("%d%d%d", &n, &g, &r);
  for (int i = 0; i <= n; i++) {
    scanf("%lld", sum + i);
    if (i) sum[i] += sum[i - 1];
    app[cnt++] = sum[i] % (r + g);
  }
  sort(app, app + cnt);
  cnt = unique(app, app + cnt) - app;
  memset(mn, 0x3f, sizeof(mn));
  for (int i = n - 1; i >= 0; i--) {
    long long x = sum[i] % (r + g) + g;
    int res = min(calc(x, r + g - 1),
                  calc(sum[i] % (r + g) - r, sum[i] % (r + g) - 1));
    if (res == 0x3f3f3f3f)
      dp[i] = sum[n] - sum[i];
    else
      dp[i] =
          sum[res] - sum[i] + (r + g - (sum[res] - sum[i]) % (r + g)) + dp[res];
    int pos = lower_bound(app, app + cnt, sum[i] % (r + g)) - app;
    modify(pos, i);
  }
  int q;
  scanf("%d", &q);
  while (q--) {
    int t;
    scanf("%d", &t);
    int st = t, res;
    t %= r + g;
    if (t <= g)
      res = calc(g - t, r + g - t - 1);
    else {
      res = min(calc(0, r + g - t - 1), calc(r + g + g - t, r + g - 1));
    }
    if (res == 0x3f3f3f3f)
      printf("%lld\n", sum[n] + st);
    else
      printf("%lld\n",
             st + sum[res] + (r + g - (st + sum[res]) % (r + g)) + dp[res]);
  }
  return 0;
}
