#include <bits/stdc++.h>
using namespace std;
const int OO = 1e9;
const long long INF = 1e18;
const int irand(int lo, int hi) {
  return ((double)rand() / (RAND_MAX + 1.0)) * (hi - lo + 1) + lo;
}
const long long lrand(long long lo, long long hi) {
  return ((double)rand() / (RAND_MAX + 1.0)) * (hi - lo + 1) + lo;
}
template <typename T>
T getnum() {
  int sign = 1;
  T ret = 0;
  char c;
  do {
    c = getchar();
  } while (c == ' ' || c == '\n');
  if (c == '-')
    sign = -1;
  else
    ret = c - '0';
  while (1) {
    c = getchar();
    if (c < '0' || c > '9') break;
    ret = 10 * ret + c - '0';
  }
  return sign * ret;
}
inline void ini(int& x) { x = getnum<int>(); }
inline void scani(int& x) { scanf("%d", &x); }
const int N = 1005;
const int C = 10005;
int n;
long long w, b, x;
int c[N];
int cost[N];
long long dp[N][C];
inline long long work(int level, int prev, int now) {
  return min(dp[level - 1][prev] + x, w + prev * b) -
         (long long)(now - prev) * cost[level];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> w >> b >> x;
  for (int i = 1; i <= n; i += 1) cin >> c[i];
  for (int i = 1; i <= n; i += 1) cin >> cost[i];
  dp[1][0] = w;
  for (int j = 1; j <= c[1]; j += 1) {
    dp[1][j] = dp[1][j - 1] - cost[1];
    if (dp[1][j] < 0) dp[1][j] = -INF;
  }
  for (int j = c[1] + 1; j <= C - 5; j += 1) dp[1][j] = -INF;
  for (int i = 2; i <= n; i += 1) {
    deque<int> dq;
    for (int j = 0; j <= C - 5; j += 1) {
      if (j - dq.front() > c[i]) dq.pop_front();
      while (!dq.empty() && work(i, dq.back(), j) <= work(i, j, j))
        dq.pop_back();
      dq.push_back(j);
      dp[i][j] = work(i, dq.front(), j);
      if (dp[i][j] < 0) dp[i][j] = -INF;
    }
  }
  int ans = 0;
  for (int j = 0; j <= C - 5; j += 1) {
    if (dp[n][j] >= 0) ans = j;
  }
  cout << ans << endl;
  return 0;
}
