module Main where import Control.Monad import Control.Applicative import Data.Maybe import Data.List import qualified Text.Printf import qualified Data.ByteString.Char8 as BC import qualified Data.ByteString as BC import Debug.Trace ------------------------------------------ lowerBound :: (Integer -> Bool) -> Integer -> Integer -> Integer lowerBound pred l r | l + 1 >= r = r | otherwise = let m = (l + r) `div` 2 in if pred m then lowerBound pred l m else lowerBound pred m r main :: IO () main = do [a, b, c] <- map fromIntegral <$> readInts let f x = x + (x `div` a) * (b - 1) print $ lowerBound ((>= c) . f) 0 (10^18) ------------------------------------------ {- Int input -} parseInt :: BC.ByteString -> Int parseInt = fst . fromJust . BC.readInt parseInts :: BC.ByteString -> [Int] parseInts = map parseInt <$> BC.words readInt :: IO Int readInt = parseInt <$> BC.getLine readInts :: IO [Int] readInts = parseInts <$> BC.getLine {- Double Formatting -} doubleFmt :: Double -> String doubleFmt = Text.Printf.printf "%.12f"