gx, gy = gets.split.map(&:to_i) px, py = gets.split.map(&:to_i) if gx.abs == gy.abs && px / gx == py / gy && px / gx < 1 puts [gx.abs,gy.abs].max + 1 else puts [gx.abs,gy.abs].max end