t = [] t[0] = gets.to_i t[1] = gets.to_i t[2] = gets.to_i dx = (t[0] * t[1]).quo(t[0] + t[1]) dy = (t[0] * t[2]).quo(t[0] + t[2]) x = dx y = 0 loop { if x == y puts x break end if x < y x += dx else y += dy end }