#include <bits/stdc++.h>
using namespace std;
int n, g, _r, t, _, a[201000], q[201000], nxt[201000];
long long sum, c, s[201000], dp[201000];
set<pair<int, int> > p;
void deal(int l, int r, int i) {
  set<pair<int, int> >::iterator it = p.lower_bound(make_pair(l, -1));
  while (it != p.end() && it->first <= r) nxt[it->second] = i, p.erase(it++);
}
int main() {
  scanf("%d%d%d", &n, &g, &_r);
  t = g + _r;
  for (int i = 0; i < n + 1; i++) scanf("%d", &a[i]);
  scanf("%d", &_);
  for (int i = 1; i < _ + 1; i++)
    scanf("%d", &q[i]), p.insert(make_pair((t - q[i] % t) % t, i + n));
  for (int i = 0; i < n + _ + 1; i++) nxt[i] = n;
  sum = 0;
  for (int i = 0; i < n + 1; i++) {
    sum = s[i] = sum + a[i];
    int l = (s[i] + 1) % t, r = (s[i] + _r) % t;
    if (l <= r)
      deal(l, r, i);
    else
      deal(l, t - 1, i), deal(0, r, i);
    p.insert(make_pair(sum % t, i));
  }
  for (int i = n; i >= 0; i--)
    if (nxt[i] == n)
      dp[i] = s[n] - s[i];
    else
      c = s[nxt[i]] - s[i], dp[i] = dp[nxt[i]] + c + t - c % t;
  for (int i = 1; i < _ + 1; i++)
    c = s[nxt[i + n]] + q[i],
    printf("%I64d\n", dp[nxt[i + n]] + c + (nxt[i + n] == n ? 0 : (t - c % t)));
}
