let () =
  let rec read () =
    try let (a,b,n) = Scanf.scanf "%d %d %d\n" (fun x y z -> (x,y,z)) in
        let a2 = if a >= b then a - (a/b)*b else a in
        let rec loop x sum = function
            0 -> sum
          | i ->
             let j = (x/b) in
             loop ((x mod b)*10) (sum+j) (i-1)
        in
        Printf.printf "%d\n" (loop (a2*10) 0 n);
        read ()
    with End_of_file -> ()
  in read ()
;;