Px,Py = gets.split.map(&:to_i) Qx,Qy = gets.split.map(&:to_i) X = Px - Qx Y = Py - Qy ans = (X.abs + Y.abs) / 2.0 puts ans