#include <bits/stdc++.h>
using namespace std;
using lli = long long;
using ld = long double;
mt19937 rnd(time(nullptr));
const lli inf = -1e18;
lli n = 0, w = 0, b = 0, x = 0;
vector<lli> c, cost;
vector<vector<lli>> dp;
inline void Solve() {
  cin >> n >> w >> b >> x;
  c.resize(n);
  cost.resize(n);
  for (auto &it : c) cin >> it;
  for (auto &it : cost) cin >> it;
  dp.resize(n + 1, vector<lli>(1e4 + 1, inf));
  dp[0][0] = w;
  for (lli i = 0; i + 1 < dp.size(); i++) {
    for (lli j = 0; j < dp[i].size(); j++) {
      if (dp[i][j] == inf) continue;
      for (lli k = 0; j + k < dp[i].size(); k++) {
        if (k > c[i]) break;
        if (min(w + j * b, dp[i][j] + x) >= k * cost[i])
          dp[i + 1][j + k] =
              max(dp[i + 1][j + k], min(w + j * b, dp[i][j] + x) - k * cost[i]);
      }
    }
  }
  lli result = 0;
  for (lli i = 0; i < dp.size(); i++) {
    for (lli j = 0; j < dp[i].size(); j++) {
      if ((dp[i][j] != inf) && (j > result)) result = j;
    }
  }
  cout << result;
}
signed main() {
  cout << fixed << setprecision(20);
  Solve();
  return 0;
}
