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