PX, PY = gets.split.map(&:to_f) QX, PY = gets.split.map(&:to_f) D = [PX, QX].minmax.reverse.inject(:-) + [PY, QY].minmax.reverse.inject(:-) puts D / 2.0