toInt x = read x :: Int
toFloat x = read x :: Float

newfloor :: Float -> Float -> Float -> Float
newfloor a b n 
     | n < b     = (fromIntegral (floor anb)) - (a * fromIntegral (floor nb))
     | otherwise = fromIntegral (floor amb) - a * fromIntegral (floor mb)
     where
          anb = a * nb
          amb = a * mb
          nb = n / b
          mb = (b-1) / b

main = do
     abn <- map toInt . words <$> getLine
     let a = fromIntegral $ head abn
         b = fromIntegral $ abn !! 1
         n = fromIntegral $ last abn
     print $ floor $ newfloor a b n


     -- [0,1,2,2,3,4,0,0,1,2]