#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1, c = getchar();
  while (c < 48) c == '-' && (f = -1), c = getchar();
  while (c > 47) x = x * 10 + c - '0', c = getchar();
  return x * f;
}
const int MAXN = 100005;
std::map<int, int> f;
long long l[MAXN], suf[MAXN];
long long n, q, g, t, ans;
inline long long reduce(long long x) { return x %= t, x + (x >> 63 & t); }
inline void insert(int i, int l, int r) {
  auto s = f.lower_bound(l), t = --f.upper_bound(r);
  int val = t->second;
  f.erase(s, ++t);
  f[l] = i;
  f[r] = val;
}
inline long long drive(int lp, long long x) {
  int rp = (--f.upper_bound(reduce(x)))->second;
  return l[rp] - l[lp] + (rp == n ? 0 : t - reduce(x + l[rp]) + suf[rp]);
}
int main(int argc, char const *argv[]) {
  n = f[0] = read() + 1;
  g = read();
  t = read() + g;
  for (int i = 1; i <= n; ++i) l[i] = l[i - 1] + read();
  for (long long i = n - 1, lp, rp; i; --i) {
    lp = reduce(g - l[i]), rp = reduce(-l[i]);
    suf[i] = drive(i, -l[i]);
    lp < rp ? insert(i, lp, rp) : (insert(i, lp, t), insert(i, 0, rp));
  }
  for (int q = read(), x; q; --q)
    x = read(), printf("%lld\n", ans = x + drive(0, x));
  return 0;
}
