#include <bits/stdc++.h>
using namespace std;
int n, green, red, period, sx, tree[1000100];
long long a[100100], f[100100];
map<int, int> d;
vector<int> X;
int getUnique(long long u) {
  return lower_bound(X.begin(), X.end(), u % period) - X.begin();
}
void add(int nd, int l, int r, int x, int v) {
  tree[nd] = v;
  if (l == r) return;
  int m = (l + r) / 2;
  if (x <= m)
    add(nd * 2, l, m, x, v);
  else
    add(nd * 2 + 1, m + 1, r, x, v);
}
int get(int nd, int l, int r, int x, int y) {
  if (l == x && r == y) return tree[nd];
  int m = (l + r) / 2, t = 0, u = 0;
  if (x <= m) t = get(nd * 2, l, m, x, min(y, m));
  if (m < y) u = get(nd * 2 + 1, m + 1, r, max(x, m + 1), y);
  if (t && u) return min(t, u);
  return t + u;
}
int main() {
  int x;
  cin >> n >> green >> red;
  period = red + green;
  for (int i = 1; i <= n + 1; i++) scanf("%d", &x), a[i] = a[i - 1] + x;
  for (int i = 0; i <= n; i++) X.push_back(a[i] % period);
  sort(X.begin(), X.end());
  X.resize(unique(X.begin(), X.end()) - X.begin());
  sx = int(X.size());
  for (int i = n; i >= 1; i--) {
    long long from = (a[i] + green) % period, to = (a[i] + period - 1) % period;
    int next = 0, l = getUnique(from),
        r = upper_bound(X.begin(), X.end(), to) - X.begin();
    r--;
    if (from <= to) {
      if (r >= l) next = get(1, 0, sx - 1, l, r);
    } else {
      if (l < sx) next = get(1, 0, sx - 1, l, sx - 1);
      int tmp = 0;
      if (r >= 0) tmp = get(1, 0, sx - 1, 0, r);
      if (tmp && next)
        next = min(next, tmp);
      else
        next += tmp;
    }
    if (!next)
      f[i] = a[n + 1] - a[i];
    else {
      long long travel = a[next] - a[i];
      f[i] = f[next] + travel + period - travel % period;
    }
    if (i) add(1, 0, sx - 1, getUnique(a[i]), i);
  }
  int q;
  cin >> q;
  while (q--) {
    int t, tt;
    scanf("%d", &t);
    tt = t % period;
    long long from = (1LL * green - tt + period) % period;
    long long to = (1LL * period - 1 - tt) % period;
    int next = 0, l = getUnique(from),
        r = upper_bound(X.begin(), X.end(), to) - X.begin();
    r--;
    if (from <= to) {
      if (r >= l) next = get(1, 0, sx - 1, l, r);
    } else {
      if (l < sx) next = get(1, 0, sx - 1, l, sx - 1);
      int tmp = 0;
      if (r >= 0) tmp = get(1, 0, sx - 1, 0, r);
      if (tmp && next)
        next = min(next, tmp);
      else
        next += tmp;
    }
    if (!next)
      cout << a[n + 1] + t << endl;
    else {
      long long travel = a[next] + t;
      cout << f[next] + travel + period - travel % period << endl;
    }
  }
}
