b = gets.chomp.split.map(&:to_i) g = b[0] - b[1] v = b[1] - b[2] r = v / g d = b[0] * r - b[1] puts b[2] * r - d