#include #include int main() { int A, B, C, D; scanf("%d%d%d%d", &A, &B, &C, &D); int n = D / (1+C); if (n > A) n = A; if (n*C > B) n = B / (n*C); printf("%d\n", n); exit(0); }