#include <bits/stdc++.h>
using namespace std;
long long n, w, b, x, c[1010], cost[1010], dp[1010][10010];
int main() {
  cin >> n >> w >> b >> x;
  for (int i = 1; i <= n; ++i) cin >> c[i];
  for (int i = 1; i <= n; ++i) cin >> cost[i];
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j < 10010; ++j) dp[i][j] = -1e18;
  dp[0][0] = w - x;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < 10010 && dp[i - 1][j] != -1e18; ++j) {
      long long mana_now = min(w + j * b, dp[i - 1][j] + x);
      for (int k = 0; k <= c[i] && mana_now >= k * cost[i]; ++k)
        dp[i][j + k] = max(dp[i][j + k], mana_now - k * cost[i]);
    }
  long long ans = -1;
  for (int i = 0; i < 10010; ++i)
    if (dp[n][i] != -1e18) ans = i;
  cout << ans;
}
