#include <bits/stdc++.h>
using namespace std;
const int max_n = 200010;
struct Node {
  int v;
  Node* next;
  void add(int v, Node*& head) {
    this->v = v;
    this->next = head;
    head = this;
  }
} nodes[max_n];
Node* h[max_n];
void add(int p, int c) {
  static Node* node = nodes;
  (node++)->add(c, h[p]);
}
int t[max_n];
int s[max_n];
long long r[max_n];
struct CMP {
  bool operator()(int a, int b) const { return t[a] < t[b]; }
};
int dl[max_n];
set<int, CMP> heap;
int main() {
  int id = 0;
  int n, g, r;
  scanf("%d %d %d", &n, &g, &r);
  for (int i = 0; i <= n; i++) {
    scanf("%d", &dl[i]);
  }
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int t;
    scanf("%d", &t);
    ::r[i] = 0;
    s[i] = t;
    t %= (r + g);
    ::t[i] = t;
    set<int, CMP>::iterator it = heap.find(i);
    if (it == heap.end()) {
      heap.insert(i);
    } else {
      int p = *it;
      add(p, i);
    }
  }
  id = q;
  long long sum = dl[n], rem = 0;
  for (int i = 0; i < n; i++) {
    sum += dl[i];
    rem = (rem + dl[i]) % (g + r);
    int shift = (rem ? g + r - rem : 0);
    t[id] = (g + shift) % (g + r);
    set<int, CMP>::iterator it = heap.find(id), it2;
    if (it == heap.end()) {
      heap.insert(id);
      it = heap.find(id);
      it2 = it;
      it2++;
      if (it2 == heap.end()) {
        heap.erase(it);
        it = heap.end();
      } else {
        int v = *it2;
        heap.erase(it);
        it = heap.find(v);
      }
    }
    for (it2 = it; it2 != heap.end(); it2++) {
      int ct = (t[*it2] + rem) % (g + r);
      if (ct >= g) {
        ::r[*it2] += (r + g - ct);
        add(id, *it2);
      } else {
        break;
      }
    }
    for (it2 = heap.begin(); it2 != it; it2++) {
      int ct = (t[*it2] + rem) % (g + r);
      if (ct >= g) {
        ::r[*it2] += (r + g - ct);
        add(id, *it2);
      } else {
        break;
      }
    }
    if (h[id]) {
      for (Node* w = h[id]; w; w = w->next) {
        heap.erase(w->v);
      }
      t[id] = shift;
      it = heap.find(id);
      if (it != heap.end()) {
        add(id, *it);
        heap.erase(*it);
      }
      heap.insert(id);
      id++;
    }
  }
  for (int i = id - 1; i >= 0; i--) {
    for (Node* w = h[i]; w; w = w->next) {
      ::r[w->v] += ::r[i];
    }
  }
  for (int i = 0; i < q; i++) {
    printf("%I64d\n", ::r[i] + sum + s[i]);
  }
  return 0;
}
