#include <bits/stdc++.h>   using namespace std;   long long V[10005], O[10005], F[1005][10005];   int c[1005], cost[1005];   int n, W, B, X;   struct Queue {     int p[1005], q[1005];     long long maxp[1005], maxq[1005];     void clear() {       *p = 0;       *q = 0;       maxp[0] = maxq[0] = -1;     }     void add(int x) {       q[++*q] = x;       maxq[*q] = max(maxq[(*q) - 1], V[x]);     }     void del() {       if (*p)         --*p;       else {         for (; *q; --*q) ++*p, maxp[*p] = max(maxp[(*p) - 1], V[p[*p] = q[*q]]);         --*p;       }     }     long long ask() { return max(maxp[*p], maxq[*q]); }   } G;   int main() {     scanf( %d%d%d%d , &n, &W, &B, &X);     for (int i = 1; i <= n; i++) scanf( %d , &c[i]);     for (int i = 1; i <= n; i++) scanf( %d , &cost[i]);     memset(F, -1, sizeof(F));     F[0][0] = W;     int sum = 0;     for (int i = 1; i <= n; i++) {       sum += c[i];       for (int j = 0; j <= sum; j++) {         for (int k = max(j - c[i], 0); k <= j; k++)           if (F[i - 1][k] >= 1ll * cost[i] * (j - k))             F[i][j] = max(F[i][j], F[i - 1][k] - 1ll * cost[i] * (j - k));         if (F[i][j] != -1) {           F[i][j] += X;           F[i][j] = min(F[i][j], W + 1ll * j * B);         }       }     }     for (int k = sum; k >= 0; k--)       if (F[n][k] >= 0) {         printf( %d n , k);         return 0;       }   }   