--import Control.Applicative ((<$>)) import Control.Monad (replicateM) import Data.Char (isSpace) import Data.List (transpose, unfoldr) import qualified Data.ByteString.Char8 as BSC8 getLL :: (BSC8.ByteString -> [Integer]) -> IO [Integer] getLL f = f <$> BSC8.getLine readILL :: (BSC8.ByteString -> Maybe (Integer, BSC8.ByteString)) -> (BSC8.ByteString -> [Integer]) readILL f = unfoldr g where g s = do (n, s') <- f s return (n, BSC8.dropWhile isSpace s') main :: IO () main = do [t, a, b] <- getLL (readILL BSC8.readInteger) print $ solve t a b solve :: Integer -> Integer -> Integer -> Integer solve t a b = (t `div` a) + 1 + (t `div` b) + 1 - (t `div` (lcm a b) + 1)