#include <bits/stdc++.h>
using namespace std;
const long long N = 1e3 + 2, M = 1e4 + 2;
long long n, w, b, x, dp[N][M], c[N], cost[N], ans;
int main() {
  ios::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];
  for (long long i = 0; i < N; ++i)
    for (long long j = 0; j < M; ++j) dp[i][j] = -1;
  dp[0][0] = w;
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 0; j < M; ++j) {
      long long max_mana = w + j * b;
      for (long long k = 0; k <= min(j, c[i]); ++k) {
        if (dp[i - 1][j - k] == -1) continue;
        long long new_mana =
            min(w + (j - k) * b, dp[i - 1][j - k] + x) - cost[i] * k;
        if (new_mana < 0) continue;
        dp[i][j] = max(dp[i][j], min(max_mana, new_mana));
        ans = max(ans, j);
      }
    }
  }
  cout << ans;
  return 0;
}
