#include <bits/stdc++.h>
using namespace std;
const int mod = (1e9) + 7;
const int siz = 1e3 + 5, siz2 = 1e4 + 5;
int n, w, b, x;
int c[siz], cost[siz];
long long dp[siz][siz2];
int solve() {
  for (int i = 0; i < siz2; i++) {
    dp[0][i] = w - (long long)i * cost[0];
    if (c[0] < i || dp[0][i] < 0) dp[0][i] = -1;
    for (int j = 1; j < n; j++) {
      dp[j][i] = -1;
      for (int k = 0; k <= c[j]; k++) {
        if (k > i) break;
        if (dp[j - 1][i - k] == -1) {
          continue;
        }
        long long now = dp[j - 1][i - k], cap = w + (long long)b * (i - k),
                  rem = min(dp[j - 1][i - k] + x, cap);
        if ((long long)k * cost[j] > rem) {
          continue;
        }
        dp[j][i] = max(dp[j][i], rem - (long long)k * cost[j]);
      }
    }
    if (dp[n - 1][i] == -1) return i - 1;
  }
}
int main() {
  scanf("%d%d%d%d", &n, &w, &b, &x);
  for (int i = 0; i < n; i++) scanf("%d", &c[i]);
  for (int i = 0; i < n; i++) scanf("%d", &cost[i]);
  printf("%d\n", solve());
  return 0;
}
