#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
vector<pair<int, int> > adj[500009];
map<int, int> pm;
long long par[500009], l[500009], dp[500009];
int sz, s[500009 << 2], pr[500009], t[500009];
int tap(int p, int nd, int x, int y) {
  if (p < 1) return 1000000007;
  if (x == y) return s[nd];
  int mid = (x + y) >> 1;
  if (p <= mid) return min(s[nd], tap(p, nd << 1, x, mid));
  return min(s[nd], tap(p, nd << 1 | 1, mid + 1, y));
}
void upd(int l, int r, int v, int nd, int x, int y) {
  if (l > y or x > r) return;
  if (l <= x and y <= r) {
    s[nd] = v;
    return;
  }
  int mid = (x + y) >> 1;
  upd(l, r, v, nd << 1, x, mid);
  upd(l, r, v, nd << 1 | 1, mid + 1, y);
}
void build(int nd, int x, int y) {
  s[nd] = 1000000007;
  if (x == y) return;
  int mid = (x + y) >> 1;
  build(nd << 1, x, mid);
  build(nd << 1 | 1, mid + 1, y);
}
int main() {
  int n, green, red;
  scanf("%d%d%d", &n, &green, &red);
  int sum = green + red;
  for (int i = 1; i <= n + 1; i++) {
    scanf("%lld", &l[i]);
    par[i] = par[i - 1] + l[i];
    pr[i] = (pr[i - 1] + l[i]) % sum;
  }
  int q;
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) scanf("%d", t + i), pm[t[i] % sum] = true;
  for (int i = 1; i <= n; i++) {
    pm[(sum - pr[i]) % sum] = true;
    if (pr[i] < green)
      adj[i].push_back(make_pair(green - pr[i], red - 1 + green - pr[i]));
    else {
      adj[i].push_back(make_pair(0, sum - pr[i] - 1));
      adj[i].push_back(make_pair(sum - pr[i] + green, sum - 1));
    }
    for (int j = 0; j < int(adj[i].size()); j++)
      pm[adj[i][j].first] = pm[adj[i][j].second] = true;
  }
  for (__typeof((pm).begin()) it = (pm).begin(); it != (pm).end(); it++)
    it->second = ++sz;
  build(1, 1, sz);
  for (int i = n; i >= 1; i--) {
    int way = (sum - pr[i]) % sum;
    int res = tap(pm[way], 1, 1, sz);
    if (res < 1000000007)
      dp[i] = par[res] - par[i] + dp[res] + sum - (par[res] - par[i]) % sum;
    else
      dp[i] = par[n + 1] - par[i];
    for (int j = 0; j < int(adj[i].size()); j++)
      upd(pm[adj[i][j].first], pm[adj[i][j].second], i, 1, 1, sz);
  }
  for (int i = 1; i <= q; i++) {
    int res = tap(pm[t[i] % sum], 1, 1, sz);
    if (res < 1000000007)
      printf("%lld\n",
             par[res] + t[i] + dp[res] + (sum - (par[res] + t[i]) % sum));
    else
      printf("%lld\n", par[n + 1] + t[i]);
  }
  return 0;
}
