func_code_string: #include <bits/stdc++.h>   using namespace std;   long long read() {     long long x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = (x << 3) + (x << 1) + (ch ^ 48);       ch = getchar();     }     return x * f;   }   long long n, w, b, x, c[1005], cost[1005], f[1005][10005], C, a[10005], tot;   long long cmp(long long x, long long y) { return x > y; }   signed main() {     n = read();     w = read();     b = read();     x = read();     for (long long i = 1; i <= n; i++) c[i] = read(), C += c[i];     for (long long i = 1; i <= n; i++) cost[i] = read();     memset(f, -0x3f, sizeof(f));     f[0][0] = w;     for (long long i = 1; i <= n; i++) {       if (i != 1)         for (long long j = 0; j <= C; j++)           f[i][j] = min(f[i - 1][j] + x, w + b * j);       else         for (long long j = 0; j <= C; j++) f[i][j] = f[i - 1][j];       tot = 0;       for (long long k = 1; k <= c[i]; k *= 2) {         a[++tot] = k;         c[i] -= k;       }       if (c[i]) a[++tot] = c[i];       sort(a + 1, a + tot + 1, cmp);       for (long long k = 1; k <= tot; k++) {         for (long long j = C; j >= a[k]; j--) {           if (f[i][j - a[k]] >= cost[i] * a[k])             f[i][j] = max(f[i][j], f[i][j - a[k]] - cost[i] * a[k]);         }       }     }     long long ans = 0;     for (long long i = C; i >= 0; i--) {       if (f[n][i] >= 0) {         ans = i;         break;       }     }     cout << ans << endl;     return 0;   }   