#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0l);
const long long MOD = 1e9 + 7;
bool debug = 0;
const int N = 1e3 + 10, M = 1e4 + 10;
long long n, w, b, x;
long long cost[N], qnts[N];
long long dp[M];
int main() {
  cin >> n >> w >> b >> x;
  for (int i = 0; i < n; i++) {
    scanf("%lld", qnts + i);
  }
  for (int i = 0; i < n; i++) scanf("%lld", cost + i);
  memset(dp, -1, sizeof(dp));
  dp[0] = w;
  for (int i = 0; i < n; i++) {
    if (i) {
      for (int j = 0; j < M - 2; j++) {
        if (dp[j] == -1) break;
        dp[j] = min(dp[j] + x, w + j * b);
      }
    }
    for (int bird = 0; bird < qnts[i]; bird++) {
      for (int j = M - 2; j >= 0; j--) {
        if (dp[j] >= cost[i]) {
          dp[j + 1] = max(dp[j + 1], dp[j] - cost[i]);
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < M - 2; i++)
    if (~dp[i]) ans = i;
  cout << ans << endl;
  return 0;
}
