def calculate_s(num_array,n)
  num_seq = Array.new
  is_recurring = false
  num_array.each do |x|
    if num_seq.include?(x)
      is_recurring = true
      break
    end
    num_seq << x
  end
  size = num_seq.size
  if !is_recurring
    if size == 1
      sum = num_seq.first
    else
      sum = num_seq[0,n].inject{|x,y| x+y}
    end
  else
    sum = num_seq.inject{|x,y| x+y}*(n/size)
    sum += num_seq[0,n].inject{|x,y| x+y} if size != 1
  end
  sum
end

readlines.each do |l|
  a,b,n = l.chomp.split.map(&:to_i)
  num_array = (a.to_f / b.to_f).to_s
  dot_index = num_array.index(".")
  num_array = num_array[dot_index+1,num_array.size-dot_index].chars.map(&:to_i)
  puts calculate_s(num_array,n)
end