countBlue :: Integer -> Integer -> Integer -> Integer
countBlue n a b
   | n > a+b   = a + (countBlue (n-a-b) a b)
   | n < a     = n
   | otherwise = a

main = do
   [n,a,b] <- map read . words <$> getLine
   putStrLn $ show $ countBlue n a b