#include <bits/stdc++.h>
using namespace std;
struct Tree {
  long long birdsAmount;
  long long cost;
};
const long long INF = -10000000000000000;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, limit, bonus, regen;
  cin >> n >> limit >> bonus >> regen;
  vector<Tree> trees(n);
  long long sum = 0;
  for (auto& i : trees) {
    cin >> i.birdsAmount;
    sum += i.birdsAmount;
  }
  for (auto& i : trees) {
    cin >> i.cost;
  }
  vector<vector<long long> > dp(sum + 1, vector<long long>(n, INF));
  for (long long i = 0; i < n; i++) {
    dp[0][i] = limit;
  }
  for (long long i = 1; i <= sum; i++) {
    if (i > trees[0].birdsAmount || i * trees[0].cost > limit) {
      dp[i][0] = INF;
    } else {
      dp[i][0] = limit - i * trees[0].cost;
    }
    for (long long j = 1; j < n; j++) {
      if (dp[i][j - 1] != INF) {
        dp[i][j] = min(dp[i][j - 1] + regen, limit + bonus * i);
      }
      for (long long k = 1; k <= trees[j].birdsAmount && k <= i; k++) {
        if (dp[i - k][j - 1] != INF &&
            min(dp[i - k][j - 1] + regen, limit + bonus * (i - k)) >=
                k * trees[j].cost) {
          dp[i][j] = max(
              dp[i][j], min(dp[i - k][j - 1] + regen, limit + bonus * (i - k)) -
                            k * trees[j].cost);
        }
      }
    }
  }
  for (long long i = sum; i >= 0; i--) {
    if (dp[i][n - 1] != INF) {
      cout << i;
      return 0;
    }
  }
  cout << 0;
  return 0;
}
