#! ruby # yukicoder My Practice # author: Leonardone @ NEETSDKASU A, B, X, Y = gets.chomp.split.map(&:to_f) case A * Y <=> B * X when -1 pust (Y + A * Y / B) when 0 puts (X + Y) when 1 puts (X + B * X / A) end