#include <bits/stdc++.h>   using namespace std;   const int maxN = 100005;   const int inf = 2147483647;   long long f[maxN], s[maxN], ans[maxN];   int n, m, c, g, r, l[maxN], a[maxN], sa[maxN];   int t[maxN * 8], b[maxN], h, mm;   int query(int l, int r) {     l = lower_bound(b + 1, b + 1 + c, l) - b;     r = upper_bound(b + 1, b + 1 + c, r) - b - 1;     l += mm - 1;     r += mm + 1;     int k = inf;     for (; l != r - 1; l >>= 1, r >>= 1) {       if ((l & 1) == 0) k = ((k) < (t[l + 1]) ? (k) : (t[l + 1]));       if ((r & 1) == 1) k = ((k) < (t[r - 1]) ? (k) : (t[r - 1]));     }     return k;   }   int ask(int x, int y) {     if (x < 0) x += g + r;     if (y < 0) y += g + r;     if (x <= y) return query(x, y);     int k = query(x, g + r - 1), t = query(0, y);     return ((k) < (t) ? (k) : (t));   }   void chg(int x, int d) {     x = lower_bound(b + 1, b + 1 + c, x) - b;     x += mm;     t[x] = d;     for (x >>= 1; x; x >>= 1)       t[x] = ((t[x + x]) < (t[x + x + 1]) ? (t[x + x]) : (t[x + x + 1]));   }   void Init() {     scanf( %d%d%d , &n, &g, &r);     for (int i = 0; i <= n; ++i) scanf( %d , l + i);     for (int i = n; i; --i) {       s[i] = s[i + 1] + l[i];       b[i] = s[i] % (g + r);     }     sort(b + 1, b + 1 + n);     c = unique(b + 1, b + 1 + n) - b - 1;     for (; (c + 1) >> h; ++h)       ;     mm = 1 << h;     for (int i = 1; i <= mm + 1 + c; ++i) t[i] = inf;     for (int i = n; i; --i) {       int k = ask((s[i] - (g + r - 1)) % (g + r), (s[i] - g) % (g + r));       if (k > n)         f[i] = s[i];       else         f[i] = (s[i] - s[k] + g + r - 1) / (g + r) * (g + r) + f[k];       chg(s[i] % (g + r), i);     }   }   void Work() {     long long p;     scanf( %d , &m);     for (int i = 1; i <= m; ++i) {       scanf( %d , a + i);       p = a[i] + l[0] + s[1];       int k = ask((p - (g + r - 1)) % (g + r), (p - g) % (g + r));       if (k > n)         printf( %I64d n , p);       else         printf( %I64d n , (p - s[k] + g + r - 1) / (g + r) * (g + r) + f[k]);     }   }   int main() {     Init();     Work();     return 0;   }   