#include <bits/stdc++.h>
struct trans_buff {
  long long x, v;
  trans_buff(long long x, long long v) : x(x), v(v) {}
};
long long l[400010], q[400010], dp[400010 << 2];
std ::vector<trans_buff> e[400010 << 2];
std ::set<std ::pair<long long, long long> > H;
int main() {
  int n;
  long long g, r, gr;
  scanf("%d%lld%lld", &n, &g, &r);
  gr = g + r;
  long long base(0);
  for (int i = 1; i <= n + 1; ++i) {
    scanf("%lld", l + i);
    base += l[i];
  }
  int Q;
  scanf("%d", &Q);
  for (int i = 1; i <= Q; ++i) {
    scanf("%lld", q + i);
    H.insert(std ::make_pair(q[i] % gr, i));
  }
  long long cur(0);
  for (int i = 1; i <= n; ++i) {
    cur = (cur + l[i]) % gr;
    long long tmp = (g + gr - cur) % gr;
    std ::set<std ::pair<long long, long long> >::iterator itl = H.lower_bound(
                                                               std ::make_pair(
                                                                   tmp, 0)),
                                                           itr;
    for (itr = itl; itr != H.end() && itr->first - tmp < r; ++itr) {
      e[Q + i].push_back(trans_buff(itr->second, r - (itr->first - tmp)));
    }
    if (itl != H.end()) H.erase(itl, itr);
    if (tmp + r > gr) {
      for (itr = H.begin(); itr != H.end() && itr->first + (gr - tmp) < r;
           ++itr) {
        e[Q + i].push_back(
            trans_buff(itr->second, r - (itr->first + (gr - tmp))));
      }
      H.erase(H.begin(), itr);
    }
    H.insert(std ::make_pair((gr - cur) % gr, Q + i));
  }
  for (int i = Q + n; i > Q; --i)
    for (std ::vector<trans_buff>::iterator it = e[i].begin(); it != e[i].end();
         ++it) {
      dp[it->x] = dp[i] + it->v;
    }
  for (int i = 1; i <= Q; ++i) printf("%lld\n", base + dp[i] + q[i]);
}
