#include <bits/stdc++.h>
using namespace std;
int n, m, W, B, X, c[1010], cost[1010], F[10010];
long long f[1010][10010], g[10010];
int main() {
  cin >> 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]);
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= 10000; j++) f[i][j] = -1000000000000000000ll;
  f[0][0] = W;
  for (int i = 1; i <= n; i++) {
    int first = 1, last = 0;
    m += c[i];
    for (int j = 0; j <= m; j++) {
      while (last > 0 && f[i - 1][F[last]] + 1ll * F[last] * cost[i] <=
                             f[i - 1][j] + 1ll * j * cost[i])
        last--;
      F[++last] = j;
      while (first < last && j - F[first] > c[i]) first++;
      f[i][j] = f[i - 1][F[first]] - 1ll * (j - F[first]) * cost[i];
      if (f[i][j] < 0) f[i][j] = -1000000000000000000ll;
    }
    for (int j = 0; j <= m; j++) f[i][j] = min(1ll * j * B + W, f[i][j] + X);
  }
  int ans = 0;
  for (int j = 0; j <= m; j++)
    if (f[n][j] >= 0) ans = j;
  cout << ans << endl;
  return 0;
}
