The determinant of a matrix 2 × 2 is defined as follows:$\operatorname{det} \left(\begin{array}{ll}{a} & {b} \\{c} & {d} \end{array} \right) = a d - b c$

A matrix is called degenerate if its determinant is equal to zero. 

The norm ||A|| of a matrix A is defined as a maximum of absolute values of its elements.

You are given a matrix $A = \left(\begin{array}{ll}{a} & {b} \\{c} & {d} \end{array} \right)$. Consider any degenerate matrix B such that norm ||A - B|| is minimum possible. Determine ||A - B||.


-----Input-----

The first line contains two integers a and b (|a|, |b| ≤ 10^9), the elements of the first row of matrix A. 

The second line contains two integers c and d (|c|, |d| ≤ 10^9) the elements of the second row of matrix A.


-----Output-----

Output a single real number, the minimum possible value of ||A - B||. Your answer is considered to be correct if its absolute or relative error does not exceed 10^{ - 9}.


-----Examples-----
Input
1 2
3 4

Output
0.2000000000

Input
1 0
0 1

Output
0.5000000000



-----Note-----

In the first sample matrix B is $\left(\begin{array}{ll}{1.2} & {1.8} \\{2.8} & {4.2} \end{array} \right)$

In the second sample matrix B is $\left(\begin{array}{ll}{0.5} & {0.5} \\{0.5} & {0.5} \end{array} \right)$

Source: codeforces | Difficulty: HARD
Tags: Sorting

Mathematics


Solutions:
from decimal import *
getcontext().prec = 50
(a, b) = list(map(int, input().split()))
(c, d) = list(map(int, input().split()))
answer = None
for k in range(1 << 4):
	le = Decimal(0)
	rg = Decimal(10 ** 11)

	def f(t):
		fi = a
		if k & 1:
			fi += t
		else:
			fi -= t
		fi *= d + t if k & 1 << 1 else d - t
		se = b + t if k & 1 << 2 else b - t
		se *= c + t if k & 1 << 3 else c - t
		return abs(fi - se)
	for i in range(200):
		m1 = le + (rg - le) / Decimal(3)
		m2 = rg - (rg - le) / Decimal(3)
		if f(m1) > f(m2):
			le = m1
		else:
			rg = m2
	if f(le) < 1e-08:
		if answer == None:
			answer = le
		else:
			answer = min(answer, le)
print(answer)


def calc_range(x, y, d):
	l1 = x - d
	r1 = x + d
	l2 = y - d
	r2 = y + d
	points = sorted([l1 * l2, l1 * r2, r1 * l2, r1 * r2])
	return (points[0], points[3])

def main():
	(a, b) = map(int, input().split())
	(c, d) = map(int, input().split())
	l = 0.0
	r = 10000000000.0
	for iter in range(100):
		m = (l + r) / 2.0
		(minA, maxA) = calc_range(a, d, m)
		(minB, maxB) = calc_range(b, c, m)
		if maxA < minB or maxB < minA:
			l = m
		else:
			r = m
	print(r)
main()


(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
z = a * d - b * c
if z == 0:
	print(0)
	exit()
t = max(abs(a + b + c + d), abs(a - b - c + d), abs(a - b + c - d), abs(a + b - c - d))
print(abs(z / t))


(a, b) = [int(x) for x in input().split()]
(c, d) = [int(x) for x in input().split()]

def isCrossing(square1, square2):
	for vert in square1:
		if vert[0] == 0 or vert[1] == 0:
			return True
		if square2[0][1] <= vert[1] * square2[0][0] / vert[0] <= square2[1][1]:
			return True
		if square2[0][0] <= vert[0] * square2[0][1] / vert[1] <= square2[3][0]:
			return True
		if square2[3][1] <= vert[1] * square2[2][0] / vert[0] <= square2[2][1]:
			return True
		if square2[1][0] <= vert[0] * square2[1][1] / vert[1] <= square2[2][0]:
			return True
	for vert in square2:
		if vert[0] == 0 or vert[1] == 0:
			return True
		if square1[0][1] <= vert[1] * square1[0][0] / vert[0] <= square1[1][1]:
			return True
		if square1[0][0] <= vert[0] * square1[0][1] / vert[1] <= square1[3][0]:
			return True
		if square1[3][1] <= vert[1] * square1[2][0] / vert[0] <= square1[2][1]:
			return True
		if square1[1][0] <= vert[0] * square1[1][1] / vert[1] <= square1[2][0]:
			return True
	return False

def binSearch(left, right, a, b, c, d):
	m = (left + right) / 2
	eps = 10 ** (-10)
	while abs(m - left) > eps and abs(right - m) > eps:
		if isCrossing(([a - m, b - m], [a - m, b + m], [a + m, b + m], [a + m, b - m]), ([c - m, d - m], [c - m, d + m], [c + m, d + m], [c + m, d - m])):
			right = m
		else:
			left = m
		m = (left + right) / 2
	return m
print(binSearch(10 ** (-10), 2 * 10 ** 9, a, b, c, d))


def minimize(m):
	ad = [m[0][0] * m[3][0], m[0][0] * m[3][1] + m[0][1] * m[3][0], m[0][1] * m[3][1]]
	bc = [m[1][0] * m[2][0], m[1][0] * m[2][1] + m[1][1] * m[2][0], m[1][1] * m[2][1]]
	det = [ad[0] - bc[0], ad[1] - bc[1], ad[2] - bc[2]]
	if det[0] != 0:
		disc = det[1] ** 2 - 4 * det[0] * det[2]
		if disc < 0:
			return []
		return [(-det[1] + disc ** 0.5) / (2 * det[0]), (-det[1] - disc ** 0.5) / (2 * det[0])]
	if det[1] != 0:
		return [-det[2] / det[1]]
	if det[2] != 0:
		return []
	return [0]

def main():
	matrix = read() + read()
	import itertools
	r = range(4)
	ans = 10 ** 18
	for i in range(5):
		for k in itertools.combinations(r, i):
			m = [(1 if j in k else -1, matrix[j]) for j in range(4)]
			for res in minimize(m):
				if abs(res) < ans:
					ans = abs(res)
	print(ans)

def read(mode=2):
	inputs = input().strip()
	if mode == 0:
		return inputs
	if mode == 1:
		return inputs.split()
	if mode == 2:
		return list(map(int, inputs.split()))

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='')
write(main())


(A, B, C, D) = map(int, (input() + ' ' + input()).split())
k = max(map(abs, [A + B + C + D, A + B - C - D, A - B + C - D, A - B - C + D])) + 1e-09
print((0, abs(A * D - B * C) / k)[bool(k)])


EPS = 1e-11
INF = float('inf')

def multiply(a, b):
	m = INF
	M = -INF
	for i in range(2):
		for j in range(2):
			m = min(m, a[i] * b[j])
			M = max(M, a[i] * b[j])
	return (m, M)

def intersect(a, b):
	return a[0] <= b[1] and b[0] <= a[1]
(a, b) = map(float, input().split())
(c, d) = map(float, input().split())
lo = 0
hi = 1000000000.0
nIters = 0
while nIters < 1000 and abs(lo - hi) > EPS:
	mi = (lo + hi) / 2
	i1 = multiply((a - mi, a + mi), (d - mi, d + mi))
	i2 = multiply((b - mi, b + mi), (c - mi, c + mi))
	if intersect(i1, i2):
		hi = mi
	else:
		lo = mi
	nIters += 1
print('{:.10f}'.format(hi))


store1 = input('').split(' ')
a = int(store1[0])
b = int(store1[1])
store2 = input('').split(' ')
c = int(store2[0])
d = int(store2[1])
lo = 0
hi = 2 * 10 ** 18
while hi - lo > 10 ** (-10) * lo:
	mid = (hi + lo) / 2.0
	mini = 2 * 10 ** 19
	maxi = -2 * 10 ** 19
	for t in range(1 << 4):
		store = [a, b, d, c]
		for k in range(4):
			if 1 << k & t != 0:
				store[k] += mid
			else:
				store[k] -= mid
		x = store[0] * store[2] - store[1] * store[3]
		if x >= maxi:
			maxi = x
		if x <= mini:
			mini = x
	if mini <= maxi and maxi >= 0 and (mini <= 0):
		hi = mid
	else:
		lo = mid
print(lo)


from decimal import *
getcontext().prec = 20
(a, b) = map(int, input().split(' '))
(c, d) = map(int, input().split(' '))
lo = 0
hi = 10 ** 9
hrd = 0
while abs(Decimal(lo) - Decimal(hi)) > 10 ** (-10) and hrd < 10000:
	mid = (lo + hi) / 2
	a1 = a - mid
	a2 = a + mid
	b1 = b - mid
	b2 = b + mid
	c1 = c - mid
	c2 = c + mid
	d1 = d - mid
	d2 = d + mid
	l = False
	h = False
	for i in [a1 * d1, a1 * d2, a2 * d1, a2 * d2]:
		for j in [b1 * c1, b1 * c2, b2 * c1, b2 * c2]:
			if i - j <= 0:
				l = True
			if i - j >= 0:
				h = True
	if l and h:
		hi = mid
	else:
		lo = mid
	hrd += 1
print(Decimal(lo))


def seg(x, y, h):
	A = [x - h, x + h]
	B = [y - h, y + h]
	Z = []
	for a in A:
		for b in B:
			Z.append(a * b)
	Z.sort()
	return (Z[0], Z[-1])

def check(a, b, c, d, h):
	(x1, y1) = seg(a, d, h)
	(x2, y2) = seg(b, c, h)
	return max(x1, x2) <= min(y1, y2)
(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
l = 0
r = max(abs(a), abs(b), abs(c), abs(d))
for i in range(100):
	m = (l + r) / 2
	if check(a, b, c, d, m):
		r = m
	else:
		l = m
print((r + l) / 2)


(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
if a * d - b * c == 0:
	print(0)
else:
	curpos = a * d - b * c >= 0
	small = 0
	large = 1e+18
	for iteration in range(200):
		avg = (small + large) / 2
		works = False
		for ach in range(-1, 2, 2):
			for bch in range(-1, 2, 2):
				for cch in range(-1, 2, 2):
					for dch in range(-1, 2, 2):
						newpos = (a + ach * avg) * (d + dch * avg) - (b + bch * avg) * (c + cch * avg) >= 0
						if newpos != curpos:
							works = True
		if works:
			large = avg
		else:
			small = avg
	print(small)


a = abs
(A, B, C, D) = map(int, (input() + ' ' + input()).split())
print(a(A * D - B * C) / max(a(A + B) + a(C + D) + 1e-09, a(A - B) + a(C - D)))


(a, b) = list(map(int, input().split()))
(c, d) = list(map(int, input().split()))
z = a * d - b * c
if z == 0:
	print(0)
	return
t = max(abs(a + b + c + d), abs(a - b - c + d), abs(a - b + c - d), abs(a + b - c - d))
print(abs(z / t))


from sys import *
(a, b, c, d) = map(int, stdin.read().split())
print(abs(a * d - b * c) / max(abs(a + b) + abs(c + d), abs(a - b) + abs(c - d), 1e-09))


from math import sqrt

def f(sa, sb, sc, sd, A, B, C, D):
	cA = sa * sd - sb * sc
	cB = sa * D + sd * A - sb * C - sc * B
	cC = A * D - B * C
	if cA == 0:
		if cB == 0:
			return 0 if cC == 0 else float('inf')
		return abs(-cC / cB)
	Dis = cB * cB - 4 * cA * cC
	if Dis < 0:
		return float('inf')
	x1 = (-cB + sqrt(Dis)) / (2 * cA)
	x2 = (-cB - sqrt(Dis)) / (2 * cA)
	return min(abs(x1), abs(x2))

def main():
	import sys
	(A, B, C, D) = [int(i) for i in sys.stdin.read().split()]
	result = float('inf')
	for sa in [-1, 1]:
		for sb in [-1, 1]:
			for sc in [-1, 1]:
				for sd in [-1, 1]:
					result = min(result, f(sa, sb, sc, sd, A, B, C, D))
	print(result)
main()


import sys
(A, B, C, D) = [int(i) for i in sys.stdin.read().split()]
if A * D - B * C == 0:
	print(0)
else:
	k1 = abs(A + D + B + C)
	k2 = abs(A + D - B - C)
	k3 = abs(A - D + B - C)
	k4 = abs(A - D - B + C)
	print(abs(A * D - B * C) / max(k1, k2, k3, k4))


import math, string, itertools, fractions, heapq, collections, re, array, bisect
from itertools import chain, dropwhile, permutations, combinations
from collections import defaultdict, deque

def VI():
	return list(map(int, input().split()))

def main(info=0):
	(a, b) = VI()
	(c, d) = VI()
	detA = a * d - b * c
	denom = max(abs(a + b + c + d), abs(a + d - c - b), abs(a + c - b - d), abs(a + b - c - d))
	ans = 0 if detA == 0 else abs(detA / denom)
	print(ans)

def __starting_point():
	main()
__starting_point()


(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
if a == b == c == d == 0:
	print(0)
else:
	x = max(abs(a + b + c + d), abs(a + b - c - d), abs(a - b + c - d), abs(a - b - c + d))
	print(abs((a * d - b * c) / x))


__author__ = 'Данила'
(a, b) = list(map(int, input().split()))
(c, d) = list(map(int, input().split()))

def solve(x, y, z):
	if y ** 2 - 4 * z * x < 0:
		return -10 ** 27
	else:
		disi = y ** 2 - 4 * z * x
		return min(abs((-y + disi ** 0.5) / 2 * x), abs((-y - disi ** 0.5) / 2 * x))
if a * d - b * c == 0:
	print(0)
else:
	det = a * d - b * c
	k = max(a + d + b + c, a - d + c - b, a - d - c + b, a + d - b - c, -a + d - b + c, -a + d - c + b, -a - d + b + c, -a - b - c - d)
	a1 = abs(det / k)
	ans = a1
	print(ans)


import sys
(A, B, C, D) = [int(i) for i in sys.stdin.read().split()]
if A * D - B * C == 0:
	result = 0
else:
	result = float('inf')
	for sa in [-1, 1]:
		for sb in [-1, 1]:
			for sc in [-1, 1]:
				for sd in [-1, 1]:
					coefA = sa * sd - sb * sc
					coefB = sa * D + sd * A - sb * C - sc * B
					coefC = A * D - B * C
					if coefA == 0 and coefB != 0:
						v = -coefC / coefB
						result = min(result, abs(v))
print(result)


import sys
(A, B, C, D) = map(int, sys.stdin.read().split())
k = max(map(abs, [A + B + C + D, A + B - C - D, A - B + C - D, A - B - C + D])) + 1e-09
print((0, abs(A * D - B * C) / k)[bool(k)])


def work(A, B, C, D):
	tmp0 = A * D - B * C
	tmp1 = a * D + d * A - b * C - c * B
	tmp2 = a * d - b * c
	if tmp0 == 0:
		if tmp1 == 0 and tmp2 == 0:
			return 0
		elif tmp1 != 0:
			return abs(tmp2 / tmp1)
	else:
		delta = tmp1 * tmp1 - tmp0 * tmp2 * 4
		if delta >= 0:
			return abs((tmp1 + delta ** 0.5) / (tmp0 * 2))
	return 1e+18
(a, b) = map(int, input().strip().split())
(c, d) = map(int, input().strip().split())
ans = 1e+18
ans = min(ans, work(1, 1, 1, 1))
ans = min(ans, work(1, 1, 1, -1))
ans = min(ans, work(1, 1, -1, 1))
ans = min(ans, work(1, 1, -1, -1))
ans = min(ans, work(1, -1, 1, 1))
ans = min(ans, work(1, -1, 1, -1))
ans = min(ans, work(1, -1, -1, 1))
ans = min(ans, work(1, -1, -1, -1))
ans = min(ans, work(-1, 1, 1, 1))
ans = min(ans, work(-1, 1, 1, -1))
ans = min(ans, work(-1, 1, -1, 1))
ans = min(ans, work(-1, 1, -1, -1))
ans = min(ans, work(-1, -1, 1, 1))
ans = min(ans, work(-1, -1, 1, -1))
ans = min(ans, work(-1, -1, -1, 1))
ans = min(ans, work(-1, -1, -1, -1))
print('%.10f' % ans)


import sys
(A, B, C, D) = [int(i) for i in sys.stdin.read().split()]
k1 = abs(A + D + B + C)
k2 = abs(A + D - B - C)
k3 = abs(A - D + B - C)
k4 = abs(A - D - B + C)
print(abs(A * D - B * C) / max(k1, k2, k3, k4, 1))


m = list(map(int, input().split() + input().split()))

def f(r):
	a = (m[0] + r) * (m[3] + r)
	b = (m[0] + r) * (m[3] - r)
	c = (m[0] - r) * (m[3] + r)
	d = (m[0] - r) * (m[3] - r)
	x1 = min(a, b, c, d)
	x2 = max(a, b, c, d)
	a = (m[1] + r) * (m[2] + r)
	b = (m[1] + r) * (m[2] - r)
	c = (m[1] - r) * (m[2] + r)
	d = (m[1] - r) * (m[2] - r)
	y1 = min(a, b, c, d)
	y2 = max(a, b, c, d)
	if y1 > x2 or x1 > y2:
		return False
	return True
l = 0
r = 10 ** 20
for i in range(10000):
	mid = (l + r) / 2
	if f(mid):
		r = mid
	else:
		l = mid
print(l)


(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
l = 0
r = 10 ** 10
if a * d == b * c:
	print(0)
else:
	for i in range(10000):
		x = (l + r) / 2
		a1 = (a - x) * (d - x)
		a2 = (a + x) * (d + x)
		a3 = (a + x) * (d - x)
		a4 = (a - x) * (d + x)
		b1 = (b - x) * (c - x)
		b2 = (b + x) * (c + x)
		b3 = (b + x) * (c - x)
		b4 = (b - x) * (c + x)
		mna = min(a1, a2, a3, a4)
		mxa = max(a1, a2, a3, a4)
		mnb = min(b1, b2, b3, b4)
		mxb = max(b1, b2, b3, b4)
		if mxa >= mnb and mxb >= mna:
			r = x
		else:
			l = x
	print('%0.10f' % x)


(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
mn = min(a * d, b * c)
mx = max(a * d, b * c)
x = 10 ** 18
if a + b + c + d != 0:
	x = abs((b * c - a * d) / (a + b + c + d))
if a + b - c - d != 0:
	x = min(abs((b * c - a * d) / (a + b - c - d)), x)
if a - b + c - d != 0:
	x = min(abs((b * c - a * d) / (a - b + c - d)), x)
if a - b - c + d != 0:
	x = min(abs((b * c - a * d) / (a - b - c + d)), x)
if a + b + c + d == 0:
	x = 0
print(x)


from math import sqrt
(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
x = []
s = []
try:
	x += [(-a * d + b * c) / (a - b - c + d)]
	s += [1, 1, 1, 1]
except:
	pass
try:
	x += [-a / 4 - b / 4 + c / 4 - d / 4 - sqrt(a ** 2 + 2 * a * b - 2 * a * c - 6 * a * d + b ** 2 + 6 * b * c + 2 * b * d + c ** 2 - 2 * c * d + d ** 2) / 4, -a / 4 - b / 4 + c / 4 - d / 4 + sqrt(a ** 2 + 2 * a * b - 2 * a * c - 6 * a * d + b ** 2 + 6 * b * c + 2 * b * d + c ** 2 - 2 * c * d + d ** 2) / 4]
	s += [1, 1, 1, -1] * 2
except:
	pass
try:
	x += [-a / 4 + b / 4 - c / 4 - d / 4 - sqrt(a ** 2 - 2 * a * b + 2 * a * c - 6 * a * d + b ** 2 + 6 * b * c - 2 * b * d + c ** 2 + 2 * c * d + d ** 2) / 4, -a / 4 + b / 4 - c / 4 - d / 4 + sqrt(a ** 2 - 2 * a * b + 2 * a * c - 6 * a * d + b ** 2 + 6 * b * c - 2 * b * d + c ** 2 + 2 * c * d + d ** 2) / 4]
	s += [1, 1, -1, 1] * 2
except:
	pass
try:
	x += [(-a * d + b * c) / (a + b + c + d)]
	s += [1, 1, -1, -1]
except:
	pass
try:
	x += [-a / 4 - b / 4 - c / 4 + d / 4 - sqrt(a ** 2 + 2 * a * b + 2 * a * c + 6 * a * d + b ** 2 - 6 * b * c - 2 * b * d + c ** 2 - 2 * c * d + d ** 2) / 4, -a / 4 - b / 4 - c / 4 + d / 4 + sqrt(a ** 2 + 2 * a * b + 2 * a * c + 6 * a * d + b ** 2 - 6 * b * c - 2 * b * d + c ** 2 - 2 * c * d + d ** 2) / 4]
	s += [1, -1, 1, 1] * 2
except:
	pass
try:
	x += [(a * d - b * c) / (a - b + c - d)]
	s += [1, -1, 1, -1]
except:
	pass
try:
	x += [(a * d - b * c) / (a + b - c - d)]
	s += [1, -1, -1, 1]
except:
	pass
try:
	x += [-a / 4 + b / 4 + c / 4 + d / 4 - sqrt(a ** 2 - 2 * a * b - 2 * a * c + 6 * a * d + b ** 2 - 6 * b * c + 2 * b * d + c ** 2 + 2 * c * d + d ** 2) / 4, -a / 4 + b / 4 + c / 4 + d / 4 + sqrt(a ** 2 - 2 * a * b - 2 * a * c + 6 * a * d + b ** 2 - 6 * b * c + 2 * b * d + c ** 2 + 2 * c * d + d ** 2) / 4]
	s += [1, -1, -1, -1] * 2
except:
	pass
try:
	x += [a / 4 - b / 4 - c / 4 - d / 4 - sqrt(a ** 2 - 2 * a * b - 2 * a * c + 6 * a * d + b ** 2 - 6 * b * c + 2 * b * d + c ** 2 + 2 * c * d + d ** 2) / 4, a / 4 - b / 4 - c / 4 - d / 4 + sqrt(a ** 2 - 2 * a * b - 2 * a * c + 6 * a * d + b ** 2 - 6 * b * c + 2 * b * d + c ** 2 + 2 * c * d + d ** 2) / 4]
	s += [-1, 1, 1, 1] * 2
except:
	pass
try:
	s += [-1, 1, 1, -1]
	x += [(-a * d + b * c) / (a + b - c - d)]
except:
	pass
try:
	x += [(-a * d + b * c) / (a - b + c - d)]
	s += [-1, 1, -1, 1]
except:
	pass
try:
	x += [a / 4 + b / 4 + c / 4 - d / 4 - sqrt(a ** 2 + 2 * a * b + 2 * a * c + 6 * a * d + b ** 2 - 6 * b * c - 2 * b * d + c ** 2 - 2 * c * d + d ** 2) / 4, a / 4 + b / 4 + c / 4 - d / 4 + sqrt(a ** 2 + 2 * a * b + 2 * a * c + 6 * a * d + b ** 2 - 6 * b * c - 2 * b * d + c ** 2 - 2 * c * d + d ** 2) / 4]
	s += [-1, 1, -1, -1] * 2
except:
	pass
try:
	x += [(a * d - b * c) / (a + b + c + d)]
	s += [-1, -1, 1, 1]
except:
	pass
try:
	x += [a / 4 - b / 4 + c / 4 + d / 4 - sqrt(a ** 2 - 2 * a * b + 2 * a * c - 6 * a * d + b ** 2 + 6 * b * c - 2 * b * d + c ** 2 + 2 * c * d + d ** 2) / 4, a / 4 - b / 4 + c / 4 + d / 4 + sqrt(a ** 2 - 2 * a * b + 2 * a * c - 6 * a * d + b ** 2 + 6 * b * c - 2 * b * d + c ** 2 + 2 * c * d + d ** 2) / 4]
	s += [-1, -1, 1, -1] * 2
except:
	pass
try:
	x += [a / 4 + b / 4 - c / 4 + d / 4 - sqrt(a ** 2 + 2 * a * b - 2 * a * c - 6 * a * d + b ** 2 + 6 * b * c + 2 * b * d + c ** 2 - 2 * c * d + d ** 2) / 4, a / 4 + b / 4 - c / 4 + d / 4 + sqrt(a ** 2 + 2 * a * b - 2 * a * c - 6 * a * d + b ** 2 + 6 * b * c + 2 * b * d + c ** 2 - 2 * c * d + d ** 2) / 4]
	s += [-1, -1, -1, 1] * 2
except:
	pass
try:
	x += [(a * d - b * c) / (a - b - c + d)]
	s += [-1, -1, -1, -1]
except:
	pass
print(min(map(abs, x)))
for i in range(len(x)):
	ss = s[4 * i:4 * i + 4]
	aa = a + x[i] * ss[0]
	dd = d + x[i] * ss[1]
	bb = b + x[i] * ss[2]
	cc = c + x[i] * ss[3]