#include using namespace std; typedef pair P; typedef pair P2; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int ans = 0; while (a > 0 && b > 0 && d > 0) { if (b >= c && c + 1 <= d) { ans++; b -= c; d -= c + 1; a--; } else { break; } } cout << ans << '\n'; return 0; }