import Control.Monad
import Control.Applicative
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import Data.Foldable (foldMap)
import Data.List.Split
import Data.Char
import Data.Ratio
import Data.Ord
import Data.Array.IO
 
readInt = read :: String -> Int
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
-- end of templete

f [a, b, n] = f' 0 (mod a b) n
  where
    f' t _ 0 = t
    f' t x n = f' (t+q) r (n-1)
      where
        (q, r) = divMod (10 * x) b

main = map (f . map read . words) . lines <$> getContents >>= mapM_ print