#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
set<pair<long long, long long> > s;
long long nxt[200005];
void red(long long l, long long r, long long now) {
  pair<long long, long long> p = make_pair(l, -1);
  while (!s.empty()) {
    auto u = s.lower_bound(p);
    if (u != s.end() && (*u).first <= r) {
      nxt[(*u).second] = now + 1;
      s.erase(u);
    } else
      break;
  }
}
long long start[100005], a[100005], su[100005];
long long n, m, rd, gr, tr, tim[100005], ans[100005];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> gr >> rd;
  tr = gr + rd;
  for (long long i = 0; i <= n; i++) {
    cin >> a[i];
    su[i + 1] = su[i] + a[i];
  }
  cin >> m;
  for (long long i = 1; i <= m; i++) {
    cin >> tim[i];
    s.insert(make_pair((tr - tim[i] % tr) % tr, n + i));
  }
  long long l, r, sum = 0;
  for (long long i = 0; i <= n + m; i++) nxt[i] = n + 1;
  for (long long i = 0; i < n; i++) {
    sum += a[i];
    l = (sum + 1) % tr;
    r = (sum + rd) % tr;
    if (l <= r) {
      red(l, r, i);
    } else {
      red(l, tr - 1, i);
      red(0, r, i);
    }
    s.insert(make_pair(sum % tr, i + 1));
  }
  long long t;
  for (long long i = n; i >= 0; i--) {
    if (nxt[i] == n + 1) {
      ans[i] = su[n + 1] - su[i];
    } else {
      t = su[nxt[i]] - su[i];
      ans[i] = ans[nxt[i]] + t + tr - t % tr;
    }
  }
  for (long long i = 1; i <= m; i++) {
    t = su[nxt[n + i]] + tim[i];
    if (nxt[n + i] <= n) {
      cout << ans[nxt[n + i]] + t + tr - t % tr;
    } else {
      cout << ans[nxt[n + i]] + t;
    }
    cout << '\n';
  }
  return 0;
}
