#include <bits/stdc++.h>
#define rep(i, ss, ee) for (int i = ss; i < ee; ++i)
using namespace std;

void solve() {
  int a, b, c, d;
  int ans = 0;
  cin >> a >> b >> c >> d;
  rep(i, 1, a + 1) {
    if (((i + i * c) > d) or (i * c > b)) break;
    ans++;
  }
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  getchar();
}