#include <bits/stdc++.h>
using namespace std;
const int kInf = 0x3f3f3f3f;
const int kNMax = 100010;
const int kDisMax = kNMax * 7;
int dis[kDisMax], nDis;
int n, g, r, p, q, L[kNMax], t[kNMax], s[kNMax];
long long ans[kNMax], S[kNMax], f[kNMax];
int fetch(int x) {
  int res = lower_bound(dis, dis + nDis, x) - dis;
  if (!(dis[res] == x)) assert(0);
  return res;
}
void addDis(int x) {
  if (0 <= x && x < p) dis[nDis++] = x;
}
struct Node {
  int l, r, val;
} node[kDisMax * 4];
void update(int i) { node[i].val = min(node[i * 2].val, node[i * 2 + 1].val); }
void build(int i, int l, int r) {
  node[i].l = l, node[i].r = r;
  node[i].val = kInf;
  if (l == r) return;
  int mid = (l + r) / 2;
  build(i * 2, l, mid);
  build(i * 2 + 1, mid + 1, r);
}
int askMin(int i, int l, int r) {
  if (node[i].l > r || node[i].r < l) return kInf;
  if (l <= node[i].l && node[i].r <= r) return node[i].val;
  return min(askMin(i * 2, l, r), askMin(i * 2 + 1, l, r));
}
int askMin(int l, int r) {
  if (l < 0) l = 0;
  if (r >= p) r = p - 1;
  if (l > r) return kInf;
  l = fetch(l);
  r = fetch(r);
  if (l > r || l < 0 || r >= nDis) return kInf;
  return askMin(1, l, r);
}
void insert(int p, int val) {
  p = fetch(p);
  int cur = 1;
  while (1) {
    if (node[cur].l == node[cur].r) break;
    int mid = (node[cur].l + node[cur].r) / 2;
    if (p <= mid)
      cur = cur * 2;
    else
      cur = cur * 2 + 1;
  }
  node[cur].val = val;
  for (cur >>= 1; cur; cur >>= 1) update(cur);
}
int main() {
  scanf("%d%d%d", &n, &g, &r);
  p = g + r;
  for (int i = 1; i <= n + 1; i++) {
    scanf("%d", &L[i]);
    s[i] = (L[i] + s[i - 1]) % p;
    S[i] = S[i - 1] + L[i];
  }
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) scanf("%d", &t[i]);
  addDis(0);
  addDis(p - 1);
  for (int i = 1; i <= n; i++) {
    addDis(s[i]);
    addDis(s[i] - 1);
    addDis(g + s[i] - p);
    addDis(g + s[i]);
  }
  for (int i = 1; i <= q; i++) {
    addDis(g - t[i] % p);
    addDis(p - t[i] % p - 1);
    addDis(g + p - t[i] % p);
  }
  sort(dis, dis + nDis);
  nDis = unique(dis, dis + nDis) - dis;
  build(1, 0, nDis - 1);
  for (int i = n; i >= 1; i--) {
    int k = min(askMin(g + s[i] - p, s[i] - 1), askMin(g + s[i], p - 1));
    if (k == kInf)
      f[i] = S[n + 1] - S[i];
    else
      f[i] = S[k] - S[i] + (p - (s[k] - s[i] + p) % p) + f[k];
    insert(s[i], i);
  }
  for (int i = 1; i <= q; i++) {
    int k = min(askMin(g - t[i] % p, p - t[i] % p - 1),
                askMin(g + p - t[i] % p, p - 1));
    if (k == kInf)
      ans[i] = t[i] + S[n + 1];
    else
      ans[i] = t[i] + S[k] + (p - (t[i] % p + s[k]) % p) + f[k];
  }
  for (int i = 1; i <= q; i++)
    printf(
        "%lld"
        "\n",
        ans[i]);
}
