A, B, C, D = map(int, input().split()) max1 = A if A < (B // C) else B // C max2 = D // (1 + C) ans = max1 if max1 < max2 else max2 print(ans)