class Yukicoder def initialize x1, y1 = gets.chomp.split.map(&:to_i) x2, y2 = gets.chomp.split.map(&:to_i) if y1 > y2 a = x1 + x2 b = y1 - y2 if x1 > x2 puts (x2 * Rational(b, a) + y2).to_f else puts (x1 * Rational(b, a) + y2).to_f end else a = x1 + x2 b = y2 - y1 if x1 > x2 puts (x2 * Rational(b, a) + y1).to_f else puts (x1 * Rational(b, a) + y1).to_f end end end end Yukicoder.new