#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 11, MAXBIRD = 1e4 + 11;
long long dp[MAXN][MAXBIRD];
int main() {
  for (int i = 0; i < MAXN; i++)
    for (int j = 0; j < MAXBIRD; j++) dp[i][j] = -1e12;
  int n;
  long long cap, b, c;
  cin >> n >> cap >> b >> c;
  vector<pair<int, int> > arr(n);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i].first);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i].second);
  for (int i = 0; i < n; i++) dp[i][0] = cap;
  int m = arr[0].first;
  int mx = 0;
  for (int i = 1; i <= m; i++) {
    long long cost = 1e12;
    if (i <= arr[0].first) cost = arr[0].second;
    dp[0][i] = cap - i * cost;
    if (dp[0][i] >= 0)
      mx = max(mx, i);
    else
      dp[0][i] = -1e12;
  }
  for (int i = 1; i < n; i++) {
    m += arr[i].first;
    for (int j = 1; j <= m; j++) {
      for (int k = 0; k <= min(j, arr[i].first); k++)
        dp[i][j] = max(dp[i][j], min(dp[i - 1][j - k] + c, cap + (j - k) * b) -
                                     1LL * k * arr[i].second);
      dp[i][j] = min(dp[i][j], cap + b * j);
      if (dp[i][j] >= 0)
        mx = max(mx, j);
      else
        dp[i][j] = -1e12;
    }
  }
  cout << mx;
}
