#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
  out << '(' << p.first << ", " << p.second << ')';
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
  long long l = v.size();
  for (long long i = 0; i < l - 1; i++) out << v[i] << ' ';
  if (l > 0) out << v[l - 1];
  return out;
}
template <typename T>
void trace(const char* name, T&& arg1) {
  cout << name << " : " << arg1 << "\n";
}
template <typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  trace(comma + 1, args...);
}
const long long N = 1e3 + 10;
const long long M = 1e4 + 10;
long long n, W, B, X;
long long c[N], cost[N];
long long dp[N][M];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> W >> B >> X;
  long long tot = 0;
  for (long long i = 1; i <= n; i++) {
    cin >> c[i];
    tot += c[i];
  }
  for (long long i = 1; i <= n; i++) {
    cin >> cost[i];
  }
  memset(dp, -1, sizeof(dp));
  dp[0][0] = W;
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= tot; j++) {
      if (dp[i - 1][j] < 0) {
        break;
      } else {
        dp[i - 1][j] = min(dp[i - 1][j] + X, W + (j * B)) + (cost[i] * j);
      }
    }
    deque<long long> q;
    for (long long j = 0; j <= tot; j++) {
      while (!q.empty() && q.front() < j - c[i]) {
        q.pop_front();
      }
      while (!q.empty() && dp[i - 1][q.front()] <= dp[i - 1][j]) {
        q.pop_back();
      }
      q.push_back(j);
      long long val = -j * cost[i] + dp[i - 1][q.front()];
      if (val < 0) {
        break;
      } else {
        ans = max(ans, j);
        dp[i][j] = val;
      }
    }
  }
  cout << ans << "\n";
}
