#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
int IT_MAX = 1 << 17;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
long long dp[1050][10050];
long long C[10050];
long long cost[10050];
int main() {
  int N, W, B, X, i, j, k;
  scanf("%d %d %d %d", &N, &W, &B, &X);
  for (i = 1; i <= N; i++) scanf("%lld", &C[i]);
  for (i = 1; i <= N; i++) scanf("%lld", &cost[i]);
  for (i = 0; i <= N; i++)
    for (j = 0; j <= 10000; j++) dp[i][j] = -LL_INF;
  dp[0][0] = W;
  for (i = 1; i <= N; i++) {
    for (j = 0; j <= 10000; j++) {
      long long v = dp[i - 1][j];
      if (v < 0) continue;
      long long mx = C[i];
      if (cost[i]) mx = min(mx, v / cost[i]);
      for (k = 0; k <= mx; k++)
        dp[i][j + k] = max(dp[i][j + k], dp[i - 1][j] - cost[i] * k);
    }
    for (j = 0; j <= 10000; j++)
      if (dp[i][j] >= 0) dp[i][j] = min(dp[i][j] + X, (long long)B * j + W);
  }
  int ans = 0;
  for (i = 1; i <= 10000; i++)
    if (dp[N][i] >= 0) ans = max(ans, i);
  return !printf("%d\n", ans);
}
