a, b, n = gets.chomp.split.map(&:to_i)
arr = []
1.upto(n){|i|
    1.upto(n){|j|
        arr << (Rational(i, j) * b - a).abs
    }
}
arr.sort!
arr.uniq!
arr.select!{|x| x.numerator % x.denominator == 0}
puts arr[0].to_i

