#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void smn(T &a, const T &b) {
  if (b < a) a = b;
}
template <class T>
inline void smx(T &a, const T &b) {
  if (b > a) a = b;
}
template <class T>
inline T rev(const T &a) {
  T _ = a;
  reverse(_.begin(), _.end());
  return _;
}
const double eps = 1e-9;
const long double leps = 1e-14;
const int INF = 1000000000 + 100, MN = (1000 * 100 + 1000);
struct node {
  node() {
    L = R = NULL;
    mn = INF;
  }
  int s, e;
  int mn;
  node *L, *R;
};
long long sum[MN];
long long d[MN];
node root;
int n, m, g, r, ts, bs, be;
void insert(node *now, int v, int k) {
  if (now->s == now->e) {
    now->mn = k;
    return;
  }
  int m = (now->s + now->e) / 2;
  if (v <= m) {
    if (now->L == NULL)
      now->L = new node, (now->L)->s = now->s, (now->L)->e = m;
    insert(now->L, v, k);
  } else {
    if (now->R == NULL)
      now->R = new node, (now->R)->s = m + 1, (now->R)->e = now->e;
    insert(now->R, v, k);
  }
  now->mn = INF;
  if (now->L != NULL) smn(now->mn, (now->L)->mn);
  if (now->R != NULL) smn(now->mn, (now->R)->mn);
}
int fnd(node *now) {
  if (now == NULL || (now->e) < bs || (now->s) > be) return INF;
  if ((now->s) >= bs && (now->e) <= be) return now->mn;
  return min(fnd(now->L), fnd(now->R));
}
int nex(int a) {
  int s = (g - a) % (g + r), e = (g + r - 1 - a) % (g + r);
  if (s < 0) s += (g + r);
  if (e < 0) e += (g + r);
  if (s <= e) {
    bs = s, be = e;
    return fnd(&root);
  }
  bs = s;
  be = g + r - 1;
  int t = fnd(&root);
  bs = 0, be = e;
  smn(t, fnd(&root));
  return t;
}
int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin >> n >> g >> r;
  root.s = 0;
  root.e = (g + r - 1);
  root.mn = INF;
  sum[0] = 0;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    sum[i] = sum[i - 1] + a;
  }
  cin >> d[n];
  sum[n + 1] = d[n] + sum[n];
  insert(&root, sum[n] % (g + r), n);
  for (int i = n - 1; i > 0; i--) {
    d[i] = sum[n + 1] - sum[i];
    int t = nex((g + r) - ((sum[i]) % (g + r)));
    if (t != INF) {
      d[i] = sum[t] - sum[i];
      int tmp = d[i] % (g + r);
      d[i] += (g + r - tmp) + d[t];
    }
    insert(&root, sum[i] % (g + r), i);
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> ts;
    long long res = sum[n + 1] + ts;
    int t = nex(ts);
    if (t != INF) {
      res = sum[t] + ts;
      int tmp = res % (g + r);
      res += (g + r - tmp) + d[t];
    }
    cout << res << '\n';
  }
  return 0;
}
