main = do [a, b, c, d] <- map read . words <$> getLine print $ minimum [d `div` (c + 1), a, b `div` c]