#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1e18;
const long long mod = (long long)1e9 + 7;
const double eps = (double)1e-9;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};
const int N = 1005;
const int M = 10005;
int n, m;
long long w, b, x, c[N], cost[N], dp[M];
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  cin >> n >> w >> b >> x;
  for (int i = 1; i <= n; i++) cin >> c[i], m += c[i];
  for (int i = 1; i <= n; i++) cin >> cost[i];
  memset(dp, -1, sizeof(dp));
  dp[0] = w;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= m; j++)
      if (dp[j] != -1) dp[j] = min(dp[j] + x, w + b * j);
    long long pw = 1;
    while (c[i]) {
      long long cur = min(c[i], pw);
      long long val = cost[i] * cur;
      for (int j = m; j >= cur; j--) dp[j] = max(dp[j], dp[j - cur] - val);
      c[i] -= cur;
      pw <<= 1;
    }
  }
  for (int i = m; i >= 0; i--) {
    if (dp[i] != -1) {
      cout << i;
      return 0;
    }
  }
  return 0;
}
