#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int c[N], cost[N];
long long dp[N][N * 10];
pair<long long, int> q[N];
int main() {
  int n, W, B, X;
  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]);
  }
  memset(dp, -1, sizeof(dp));
  dp[0][0] = W;
  int max_last = W, sum = 0, res = 0;
  for (int i = 1; i <= n; i++) {
    sum += c[i];
    max_last = -1;
    int l = 0, r = 0;
    for (int j = 0; j <= sum; j++) {
      if (j > c[i] && l < r && q[l].second == j - c[i] - 1) {
        l++;
      }
      if (dp[i - 1][j] >= 0) {
        long long now = dp[i - 1][j] + 1ll * cost[i] * j;
        while (r > l && q[r - 1].first <= now) r--;
        q[r++] = make_pair(now, j);
      }
      if (l < r)
        dp[i][j] = q[l].first - 1ll * cost[i] * j;
      else
        continue;
      if (dp[i][j] >= 0) {
        res = max(res, j);
        dp[i][j] += X;
      }
      if (dp[i][j] > W + 1ll * B * j) dp[i][j] = W + 1ll * B * j;
    }
  }
  cout << res << endl;
}
