func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, G, R, d[100127], w[100127], rt, tot = 0, mi[100127 * 20],                                             c[100127 * 20][2];   long long f[100127], s[100127], ans;   void change(int &p, int l, int r, int x, int v) {     if (!p) p = ++tot;     mi[p] = v;     if (l == r) return;     int mid = (1ll * l + r) >> 1;     (x <= mid) ? change(c[p][0], l, mid, x, v)                : change(c[p][1], mid + 1, r, x, v);   }   int Ask(int p, int l, int r, int L, int R) {     if (R < L) return n + 1;     if ((!p) || (R < l) || (r < L)) return n + 1;     if ((L <= l) && (r <= R)) return mi[p];     int mid = (1ll * l + r) >> 1;     return min(Ask(c[p][0], l, mid, L, R), Ask(c[p][1], mid + 1, r, L, R));   }   inline int Get(int v) {     if (v >= R) return Ask(rt, 0, R + G - 1, (v + G) % (R + G), v - 1);     return min(Ask(rt, 0, R + G - 1, v + G, R + G - 1),                Ask(rt, 0, R + G - 1, 0, v - 1));   }   inline long long calc(int x, int y, int v) {     if (y == n + 1) return 0;     v = (v + s[y] - s[x]) % (R + G);     return R + G - v;   }   int main() {     scanf( %d%d%d , &n, &G, &R);     int i, p, x;     for (i = 1; i <= n + 1; i++) scanf( %d , &d[i]);     w[n + 1] = n + 1;     f[n + 1] = 0;     for (i = 2; i <= n + 1; i++) s[i] = s[i - 1] + d[i];     for (i = n; i >= 1; i--) {       w[i] = Get(s[i] % (R + G));       change(rt, 0, R + G - 1, s[i] % (R + G), i);     }     for (i = n; i >= 1; i--) f[i] = f[w[i]] + s[w[i]] - s[i] + calc(i, w[i], 0);     scanf( %d , &m);     while (m--) {       scanf( %d , &x);       ans = d[1] + x;       x = (x + d[1]) % (G + R);       if (x >= G) {         ans += R + G - x;         x = 0;       }       p = Get((R + G - x) % (R + G));       ans += f[p] + s[p] + calc(1, p, x);       printf( %lld n , ans);     }     return 0;   }   