#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, const T& b) {
  return a > b ? a = b, true : false;
}
template <class T>
bool umax(T& a, const T& b) {
  return a <= b ? a = b, true : false;
}
void FRE(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
const long long N = 1e3 + 5;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
const long double Pi = acos(-1);
const long long B = 1e4 + 5;
long long n, m, s, q, k, ans, res, a[N];
long long mx, rise, add;
long long cnt[N], cost[N];
long long dp[N][B], left[N][B];
long long pos[N][B];
void solve(long long t_case) {
  cin >> n >> mx >> rise >> add;
  for (long long i = 1; i <= n; i++) cin >> cnt[i], k += cnt[i];
  for (long long i = 1; i <= n; i++) cin >> cost[i];
  memset(dp, -1, sizeof dp);
  dp[0][0] = mx;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      for (long long k = 0; k <= min(j, cnt[i]); k++) {
        if (dp[i - 1][j - k] == -1) continue;
        long long nwm =
            min(dp[i - 1][j - k] + add, mx + (j - k) * rise) - cost[i] * k;
        if (nwm < 0) continue;
        umax(dp[i][j], min(nwm, mx + j * rise)), umax(res, j);
      }
    }
  }
  cout << res << "\n";
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if (!0) {
    solve(1);
  } else {
    long long t;
    cin >> t;
    for (long long t_case = 1; t_case <= t; t_case++) solve(t_case);
  }
  return 0;
}
