#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 10, INF = 0x3f3f3f3f;
long long l[MAXN], f[MAXN];
int n, g, r, q;
vector<int> idx;
struct seg_tree {
  int minv, l, r, vl, vr;
} t[MAXN * 4];
void Update(int x) {
  t[x].minv = min(t[(x << 1)].minv, t[((x << 1) + 1)].minv);
}
void Build(int x, int l, int r) {
  t[x].l = l, t[x].r = r, t[x].minv = n;
  t[x].vl = idx[l], t[x].vr = idx[r - 1];
  if (l == r - 1) return;
  Build((x << 1), l, ((t[x].l + t[x].r) >> 1)),
      Build(((x << 1) + 1), ((t[x].l + t[x].r) >> 1), r);
  Update(x);
}
int Query(int x, int L, int R) {
  if (L > R) return n;
  if (t[x].vl > R || t[x].vr < L) return n;
  if (L <= t[x].vl && t[x].vr <= R) return t[x].minv;
  return min(Query((x << 1), L, R), Query(((x << 1) + 1), L, R));
}
void Insert(int x, int p, int z) {
  if (t[x].l == p && t[x].r - 1 == p) {
    t[x].minv = min(t[x].minv, z);
    return;
  }
  if (p < ((t[x].l + t[x].r) >> 1))
    Insert((x << 1), p, z);
  else
    Insert(((x << 1) + 1), p, z);
  Update(x);
}
void init() {
  cin >> n >> g >> r;
  for (int i = 0; i <= n; ++i) {
    cin >> l[i];
    if (i) l[i] += l[i - 1];
    idx.push_back(l[i] % (r + g));
  }
  sort(idx.begin(), idx.end());
  idx.erase(unique(idx.begin(), idx.end()), idx.end());
  Build(1, 0, idx.size());
}
int calc(long long curs, int i) {
  int w = (i + r + g - curs % (r + g)) % (r + g);
  if (g >= w)
    return Query(1, g - w, r + g - w - 1);
  else
    return min(Query(1, 0, r + g - w - 1), Query(1, g - w + r + g, r + g - 1));
}
void solve() {
  f[n] = 0;
  for (int i = n - 1; i >= 0; --i) {
    int j = calc(l[i], 0);
    f[i] = l[j] - l[i];
    if (j < n) f[i] += f[j] + g + r - (l[j] - l[i]) % (g + r);
    Insert(1, lower_bound(idx.begin(), idx.end(), l[i] % (r + g)) - idx.begin(),
           i);
  }
  scanf("%d", &q);
  for (int i = 1; i <= q; ++i) {
    int t;
    scanf("%d", &t);
    int j = calc(0, t);
    long long CC = t + l[j];
    if (j < n) CC += f[j] + r + g - (t + l[j]) % (r + g);
    cout << CC << endl;
  }
}
int main() {
  init();
  solve();
  fclose(stdin);
  fclose(stdout);
  return 0;
}
