#include int main() { int a, b, c, d; scanf("%d %d %d %d", &a, &b, &c, &d); int ans; for (ans = 0; ans <= a; ans++) { if (b < ans * c) break; if (ans * (c + 1) > d) break; } ans--; printf("%d\n", ans); return 0; }