#include <bits/stdc++.h>
using namespace std;
long long n, w, b, x, cnt, f[10 * 1001], c[1001], v[1001];
int main() {
  cin >> n >> w >> b >> x;
  for (long long i = 1; i <= n; i++) cin >> c[i];
  for (long long i = 1; i <= n; i++) cin >> v[i];
  f[0] = w;
  for (long long i = 1; i <= n; i++) {
    for (long long j = cnt; j >= 0; j--)
      for (long long k = 0; f[j] >= k * v[i] && k <= c[i]; k++)
        f[j + k] = max(f[j + k], f[j] - k * v[i]), cnt = max(cnt, j + k);
    for (long long j = 0; j <= cnt; j++) f[j] = min(f[j] + x, w + b * j);
  }
  cout << cnt;
}
