#include <bits/stdc++.h>
using namespace std;
long long n, maxx, huifu_bird, huifu_next;
long long number[1010];
long long cost[1010];
long long dp[2][10001];
int main() {
  while (cin >> n >> maxx >> huifu_bird >> huifu_next) {
    for (int i = 0; i < n; i++) cin >> number[i];
    for (int i = 0; i < n; i++) cin >> cost[i];
    for (int i = 0; i <= 10000; i++) dp[0][i] = -1;
    for (int i = 0; i <= 10000; i++) dp[1][i] = -1;
    for (int i = 0; i <= number[0]; i++) {
      if (maxx < cost[0] * i) break;
      long long a = maxx - cost[0] * i + huifu_next;
      if (a > maxx + huifu_bird * i) a = maxx + huifu_bird * i;
      dp[0 % 2][i] = a;
    }
    for (int i = 1; i < n; i++) {
      for (int j = 0; j <= 10000; j++) {
        if (j >= number[i] && dp[(i + 1) % 2][j - number[i]] == -1) break;
        long long ans = -1;
        for (int k = 0; k <= number[i]; k++) {
          if (j - k < 0) break;
          if (dp[(i + 1) % 2][j - k] >= cost[i] * k) {
            long long a = dp[(i + 1) % 2][j - k] - cost[i] * k + huifu_next;
            if (a > maxx + huifu_bird * j) a = maxx + huifu_bird * j;
            ans = max(a, ans);
          }
        }
        dp[i % 2][j] = ans;
      }
    }
    int ans = 0;
    for (int i = 10000; i >= 0; i--) {
      if (dp[(n - 1) % 2][i] != -1) {
        ans = i;
        break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
