#include <bits/stdc++.h>
using namespace std;
const int C = 10005, N = 1005;
int n, w, b, x, c[N], cost[N];
long long dp[2][C];
template <class T>
void maxz(T &a, T b) {
  if (a < b) a = b;
}
int main() {
  int i, j, k, ub;
  long long mn;
  scanf("%d%d%d%d", &n, &w, &b, &x);
  for (i = 1; i <= n; i++) scanf("%d", c + i);
  for (i = 1; i <= n; i++) scanf("%d", cost + i);
  memset(dp[0], -1, sizeof(dp[0]));
  ub = 1;
  dp[0][0] = w;
  for (i = 1; i <= n; i++) {
    memset(dp[i & 1], -1, sizeof(dp[0]));
    for (j = 0; j < ub; j++)
      if (dp[~i & 1][j] >= 0) {
        mn = min(dp[~i & 1][j] + x, w + (long long)b * j);
        for (k = 0; k <= c[i] && mn >= 0; k++) {
          maxz(dp[i & 1][j + k], mn);
          mn -= cost[i];
        }
        maxz(ub, j + k);
      }
  }
  printf("%d", ub - 1);
  return 0;
}
