#include <bits/stdc++.h>
using namespace std;
const int N = 10005;
long long dp[1005][N];
int a[1005];
long long c[1005];
int ans;
int n;
long long w, b, x;
void solve() {
  memset(dp, 0xff, sizeof(dp));
  dp[0][0] = w;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= 10000 && dp[i - 1][j] != -1; j++) {
      for (int k = 0; k <= a[i]; k++) {
        if (dp[i - 1][j] - k * c[i] * 1LL < 0) break;
        dp[i][j + k] = max(min(dp[i - 1][j] + x - c[i] * k, w + (j + k) * b),
                           dp[i][j + k]);
      }
    }
  }
  for (int j = 0; j <= 10000 && dp[n][j] != -1; j++) ans = j;
  cout << ans << endl;
}
int main() {
  cin.sync_with_stdio(false);
  cin >> n >> w >> b >> x;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
  }
  solve();
  return 0;
}
