#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
const int maxn = 200010;
int n, q, g, r, tot, d[maxn], rt[maxn];
long long sum, f[maxn];
struct node {
  int l, r, v;
} t[maxn * 20];
void modify(int &k1, int k2, int l, int r, int p, int v) {
  t[k1 = ++tot] = t[k2], t[k1].v = v;
  if (l == r) return;
  int mid = (l + r) >> 1;
  if (mid >= p)
    modify(t[k1].l, t[k2].l, l, mid, p, v);
  else
    modify(t[k1].r, t[k2].r, mid + 1, r, p, v);
}
int query(int k, int l, int r, int ql, int qr) {
  if (!k) return n;
  if (l == ql && r == qr) return t[k].v;
  int mid = (l + r) >> 1;
  if (mid >= qr)
    return query(t[k].l, l, mid, ql, qr);
  else if (mid < ql)
    return query(t[k].r, mid + 1, r, ql, qr);
  else
    return min(query(t[k].l, l, mid, ql, mid),
               query(t[k].r, mid + 1, r, mid + 1, qr));
}
int main() {
  scanf("%d %d %d", &n, &g, &r), n++;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &d[i]), sum += d[i];
    d[i] = (d[i] + d[i - 1]) % (g + r);
  }
  for (int i = n; i >= 0; i--) {
    modify(rt[i], rt[i + 1], 0, g + r - 1, d[i], i);
  }
  for (int i = n - 1, t, p1, p2, p; i >= 0; i--) {
    t = g + r - d[i];
    p1 = query(rt[i + 1], 0, g + r - 1, max(g - t, 0), g + r - 1 - t);
    p2 = g < t ? query(rt[i + 1], 0, g + r - 1, g + g + r - t, g + r - 1) : n;
    p = min(p1, p2);
    f[i] = p == n ? 0 : f[p] + (g + r - (0LL + d[p] + t) % (g + r)) % (g + r);
  }
  scanf("%d", &q);
  for (int i = 1, x, t, p1, p2, p; i <= q; i++) {
    scanf("%d", &x), t = x % (g + r);
    p1 = query(rt[1], 0, g + r - 1, max(g - t, 0), g + r - 1 - t);
    p2 = g < t ? query(rt[1], 0, g + r - 1, g + g + r - t, g + r - 1) : n;
    p = min(p1, p2);
    long long k =
        p == n ? 0 : f[p] + (g + r - (0LL + d[p] + t) % (g + r)) % (g + r);
    printf("%lld\n", x + sum + k);
  }
  return 0;
}
