#include <bits/stdc++.h>
using namespace std;
long long n, v[1005], c[1005], w, b, x, dp[1005][10005];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> w >> b >> x;
  long long soma = 0;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    soma += v[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
  }
  for (int i = 1; i <= n + 1; i++) {
    for (int j = 1; j <= soma + 1; j++) {
      dp[i][j] = -0x3f3f3f3f3f3f3f3f;
    }
  }
  for (int i = 1; i <= n; i++) {
    dp[i][0] = w;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= soma; j++) {
      if (i == 1) {
        if (j > v[i]) break;
        for (int k = 1; k <= j && k <= v[i]; k++) {
          dp[i][j] = w - k * c[i];
        }
      } else {
        for (int k = 0; k <= j && k <= v[i]; k++) {
          dp[i][j] =
              max(dp[i][j],
                  max(dp[i - 1][j],
                      min(dp[i - 1][j - k] + x, w + (j - k) * b) - k * c[i]));
        }
      }
      if (dp[i][j] < 0) {
        dp[i][j] = -0x3f3f3f3f3f3f3f3f;
      }
    }
  }
  for (int i = soma; i >= 0; i--) {
    if (dp[n][i] >= 0) {
      cout << i;
      return 0;
    }
  }
  return 0;
}
