#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010, mod = 1000000007;
int n, G, R, q, nn, M[maxn << 2];
long long L[maxn], d[maxn];
map<int, int> xx;
map<int, int>::iterator it;
int mmin(int x, int y) { return (!x || (y && y < x)) ? y : x; }
void update(int x, int v, int l, int r, int rt) {
  if (l == r) {
    if (!M[rt] || v < M[rt]) M[rt] = v;
    return;
  }
  int mid = (l + r) >> 1;
  if (x <= mid)
    update(x, v, l, mid, rt << 1);
  else
    update(x, v, mid + 1, r, rt << 1 | 1);
  M[rt] = mmin(M[rt << 1], M[rt << 1 | 1]);
}
int query(int s, int e, int l, int r, int rt) {
  if (s <= l && e >= r) return M[rt];
  int mid = (l + r) >> 1, ret = 0;
  if (s <= mid) ret = mmin(ret, query(s, e, l, mid, rt << 1));
  if (e > mid) ret = mmin(ret, query(s, e, mid + 1, r, rt << 1 | 1));
  return ret;
}
int main() {
  cin >> n >> G >> R;
  for (int i = 1; i <= n + 1; i++) cin >> L[i], L[i] += L[i - 1];
  xx[0] = 1, xx[G + R - 1] = 1;
  for (int i = 1; i <= n; i++) xx[L[i] % (G + R)] = 1;
  for (it = xx.begin(); it != xx.end(); it++) it->second = ++nn;
  d[n] = L[n + 1] - L[n];
  update(xx[L[n] % (G + R)], n, 1, nn, 1);
  int v1, v2, l, r, t;
  for (int i = n - 1; i >= 0; i--) {
    v1 = (G + L[i]) % (G + R);
    v2 = (G + R - 1 + L[i]) % (G + R);
    l = xx.lower_bound(v1)->second;
    r = (--xx.upper_bound(v2))->second;
    if (l <= r)
      t = query(l, r, 1, nn, 1);
    else if (v1 > v2)
      t = mmin(query(l, nn, 1, nn, 1), query(1, r, 1, nn, 1));
    else
      t = 0;
    if (t)
      d[i] = L[t] - L[i] + G + R - (L[t] - L[i]) % (G + R) + d[t];
    else
      d[i] = L[n + 1] - L[i];
    if (i) update(xx[L[i] % (G + R)], i, 1, nn, 1);
  }
  cin >> q;
  while (q--) {
    long long x;
    cin >> x;
    v1 = ((G - x) % (G + R) + G + R) % (G + R);
    v2 = ((G + R - 1 - x) % (G + R) + G + R) % (G + R);
    l = xx.lower_bound(v1)->second;
    r = (--xx.upper_bound(v2))->second;
    if (l <= r)
      t = query(l, r, 1, nn, 1);
    else if (v1 > v2)
      t = mmin(query(l, nn, 1, nn, 1), query(1, r, 1, nn, 1));
    else
      t = 0;
    if (t)
      cout << x + L[t] + G + R - (L[t] + x) % (G + R) + d[t] << endl;
    else
      cout << x + L[n + 1] << endl;
  }
  return 0;
}
