#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 10;
const int MAXC = 1e4 + 10;
struct item {
  long long int num, v;
};
long long int dp[MAXC];
int n;
long long int w, b, x, sumc;
long long int num[MAXN], v[MAXN];
vector<item> s;
void setItem(int i) {
  s.clear();
  long long int now = num[i];
  long long int p = 1;
  while (now != 0) {
    if (now >= p) {
      item x;
      x.num = p;
      x.v = p * v[i];
      s.push_back(x);
      now -= p;
      p <<= 1;
    } else {
      item x;
      x.num = now;
      x.v = now * v[i];
      s.push_back(x);
      now = 0;
    }
  }
}
void ceshi() {
  for (int i = 0; i <= sumc; ++i) {
    printf("%I64d ", dp[i]);
  }
  printf("\n");
}
int main() {
  scanf("%d%I64d%I64d%I64d", &n, &w, &b, &x);
  sumc = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d", &num[i]);
    sumc += num[i];
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d", &v[i]);
  }
  memset(dp, -1, sizeof(dp));
  dp[0] = w;
  for (int i = 1; i <= n; ++i) {
    setItem(i);
    for (int j = 0; j <= sumc; ++j) {
      if (dp[j] == -1) {
        continue;
      }
      long long int limit = j * b + w;
      dp[j] = min(dp[j] + x, limit);
    }
    for (int j = 0; j < s.size(); ++j) {
      for (int k = sumc; k >= s[j].num; --k) {
        if (dp[k - s[j].num] == -1) {
          continue;
        }
        long long int mana = dp[k - s[j].num];
        if (mana >= s[j].v) {
          dp[k] = max(dp[k], mana - s[j].v);
        }
      }
    }
  }
  int maxn = 0;
  for (int i = sumc; i >= 0; --i) {
    if (dp[i] >= 0) {
      maxn = i;
      break;
    }
  }
  printf("%d\n", maxn);
  return 0;
}
