#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 100;
int n;
long long G, R, a[N], t[N];
pair<long long, int> b[N];
int pos[N], f[N * 4];
void update(int &x, int y) {
  if (y != -1)
    if (x == -1 || y < x) x = y;
}
int find(int x, int sl, int sr, long long ql, long long qr) {
  if (qr < b[sl].first || ql > b[sr].first) return -1;
  if (ql <= b[sl].first && b[sr].first <= qr) return f[x];
  int sm = (sl + sr) / 2, ret = -1;
  if (ql <= b[sm].first) update(ret, find(2 * x, sl, sm, ql, qr));
  if (qr >= b[sm + 1].first) update(ret, find(2 * x + 1, sm + 1, sr, ql, qr));
  return ret;
}
void updateF(int x, int sl, int sr, int pos, int id) {
  update(f[x], id);
  if (sl == sr) return;
  int sm = (sl + sr) / 2;
  if (pos <= sm)
    updateF(2 * x, sl, sm, pos, id);
  else
    updateF(2 * x + 1, sm + 1, sr, pos, id);
}
long long solve(long long a, long long b, long long p) {
  a = ((a % p) + p) % p;
  int ret = -1;
  update(ret, find(1, 1, n, b - a, p - a - 1));
  update(ret, find(1, 1, n, p - a + b, p));
  return ret;
}
int main() {
  cin >> n >> G >> R;
  for (int i = (1); i <= (n + 1); i++) {
    int x;
    scanf("%d", &x);
    a[i] = a[i - 1] + x;
    b[i] = make_pair(a[i] % (R + G), i);
  }
  sort(b + 1, b + n + 1);
  for (int i = (1); i <= (n); i++) pos[b[i].second] = i;
  memset(f, 0xff, sizeof f);
  for (int i = (n); i >= (1); i--) {
    long long z = solve(-a[i], G, G + R);
    if (z != -1) {
      t[i] = t[z] + (a[z] - a[i]) + (R + G - (a[z] - a[i]) % (R + G));
    } else {
      t[i] = a[n + 1] - a[i];
    }
    updateF(1, 1, n, pos[i], i);
  }
  int Q;
  cin >> Q;
  while (Q--) {
    int xx;
    scanf("%d", &xx);
    long long z = solve(xx, G, G + R), ret;
    if (z != -1) {
      ret = t[z] + a[z] + xx + (R + G - (a[z] + xx) % (R + G));
    } else {
      ret = a[n + 1] + xx;
    }
    cout << ret << endl;
  }
  return 0;
}
