#include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)1e18;
const int MAXN = 1003;
const int BASE = (int)1e9 + 7;
const int BLOCK = 450;
int n;
long long f[MAXN * 10];
long long B, X;
long long W;
int c[MAXN];
int cost[MAXN];
int main() {
  memset(f, -1, sizeof(f));
  cin >> n >> W >> B >> X;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> cost[i];
  }
  f[0] = W;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = ans; j >= 0; j--) {
      long long curF = min(f[j] + X, W + j * B);
      f[j] = max(f[j], curF);
      for (int k = 1; k <= c[i]; k++) {
        if (curF - cost[i] >= 0) {
          curF = min(curF - cost[i], W + j * B);
          f[j + k] = max(f[j + k], curF);
          ans = max(ans, j + k);
        } else
          break;
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
