#include <bits/stdc++.h>
using namespace std;
const long long NR = 1e4 + 10;
void Max(long long &x, long long y) { x = max(x, y); }
long long n, w, b, x;
long long sumc;
long long c[NR], co[NR];
long long dp[2][25][NR];
long long getnum(long long x) {
  long long p = 0, cnt = 0;
  for (long long i = 1;; i *= 2) {
    p += i;
    cnt++;
    if (p >= x) return cnt;
  }
}
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;
}
signed main() {
  memset(dp, -0x3f, sizeof(dp));
  n = read(), w = read(), b = read(), x = read();
  for (long long i = 1; i <= n; i++) c[i] = read();
  for (long long i = 1; i <= n; i++) co[i] = read();
  dp[0][0][0] = w;
  long long ans = -0x3f3f3f3f;
  long long noww = 0;
  for (long long i = 1; i <= n; i++) {
    sumc += c[i];
    for (long long j = 0; j <= sumc; j++)
      for (long long k = 0; k <= noww; k++)
        Max(dp[1][0][j], min(w + b * j, dp[0][k][j] + x));
    noww = getnum(c[i]);
    for (long long j = 0; j <= sumc; j++) {
      long long sum = 0;
      long long now = 0;
      for (long long k = 1; k <= c[i]; k *= 2) {
        sum += k;
        now++;
        Max(dp[1][now][j], dp[1][now - 1][j]);
        if (sum > c[i] || k > j) {
          sum -= k;
          break;
        }
        if (co[i] * k <= dp[1][now - 1][j - k])
          Max(dp[1][now][j], dp[1][now - 1][j - k] - co[i] * k);
      }
      for (long long k = 1; k <= noww; k++) Max(dp[1][k][j], dp[1][k - 1][j]);
      long long p = c[i] - sum;
      if (p <= 0 || p > j) continue;
      Max(dp[1][now][j], dp[1][now - 1][j]);
      if (co[i] * p <= dp[1][now - 1][j - p])
        Max(dp[1][now][j], dp[1][now - 1][j - p] - co[i] * p);
      for (long long k = 1; k <= noww; k++) Max(dp[1][k][j], dp[1][k - 1][j]);
    }
    memcpy(dp[0], dp[1], sizeof(dp[0]));
  }
  for (long long i = sumc; i >= 0; i--) {
    bool flag = 0;
    for (long long j = 0; j <= 20; j++)
      if (dp[1][j][i] >= 0) flag = 1;
    if (flag) {
      ans = i;
      break;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
