#include <bits/stdc++.h>
using namespace std;
const long long inf = 1ll << 60;
const int N = 1010, M = 10001;
long long dp[2][M], c[N], cost[N], B, W, X;
int n, all;
int main() {
  scanf("%d %lld %lld %lld", &n, &W, &B, &X);
  for (int i = 0; i < n; i++) scanf("%lld", c + i);
  for (int i = 0; i < n; i++) scanf("%lld", cost + i);
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < M; j++) dp[i][j] = -inf;
  dp[0][0] = W;
  for (int i = 0; i < n; all += c[i], i++) {
    for (int j = 0; j <= all; j++) dp[1 - i & 1][j] = -inf;
    for (int j = 0; j <= all; j++) {
      if (dp[i & 1][j] < 0) continue;
      dp[1 - i & 1][j] =
          max(dp[1 - i & 1][j], min(dp[i & 1][j] + X, W + 1ll * j * B));
      for (int k = 0; k <= c[i]; k++) {
        if (dp[i & 1][j] < 1ll * k * cost[i]) break;
        long long high = W + (j + k) * B;
        dp[1 - i & 1][j + k] =
            max(dp[1 - i & 1][j + k],
                min(high, dp[i & 1][j] - 1ll * k * cost[i] + X));
      }
    }
  }
  for (int j = all; j >= 0; j--)
    if (dp[n & 1][j] >= 0) {
      printf("%d\n", j);
      break;
    }
  return 0;
}
