#include using namespace std; using ll = long long; int main() { int a, b, c, d, ans = 0; cin >> a >> b >> c >> d; while (1 + c >= d && a > 0 && b >= c) { ans++; b -= c; a--; } cout << ans << endl; }