#include <bits/stdc++.h>
using namespace std;
const long long M = 1e3 + 5;
const long long N = 1e4 + 5;
long long n, w, b, x, c[M], cost[M], dp[M][N];
long long solve(long long i, long long birds) {
  if (i == 0) {
    if (birds == 0) return w;
    return -1e18;
  }
  if (dp[i][birds] != -1) return dp[i][birds];
  long long ans = -1e18;
  for (long long j = 0; j <= min(birds, c[i]); j++) {
    long long nxt = solve(i - 1, birds - j);
    if (nxt < 0) continue;
    long long cur = min(nxt + x, w + (birds - j) * b) - cost[i] * j;
    ans = max(ans, cur);
  }
  return dp[i][birds] = ans;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> w >> b >> x;
  for (long long i = 1; i <= n; i++) cin >> c[i];
  for (long long i = 1; i <= n; i++) cin >> cost[i];
  memset(dp, -1, sizeof dp);
  for (long long i = N - 5; i >= 0; i--)
    if (solve(n, i) >= 0) return cout << i, 0;
  return 0;
}
