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)$

Difficulty: interview

Starter code:

Solutions:
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 = list(map(int, input().split()))
c, d = list(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)



"""
Codeforces Looksery Cup 2015 Problem H

Author  : chaotic_iak
Language: Python 3.4.2
"""

################################################### SOLUTION

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**.5) / (2*det[0]), (-det[1] - disc**.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)



#################################################### HELPERS



def read(mode=2):
    # 0: String
    # 1: List of strings
    # 2: List of integers
    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())

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)


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 = list(map(float, input().split()))
c, d = list(map(float, input().split()))


lo = 0
hi = 1e9

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))


__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**.5)/2*x), abs((-y - disi**.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
    if solve(2, -a - d - c + b, det) != -10**27:
        ans = min(ans, solve(2, -a - d - c + b, det))
    if solve(2, -a - d + c - b, det) != -10**27:
        ans = min(ans, solve(2, -a - d + c - b, det))
    if solve(2, a + d + c - b, det)!= -10**27:
        ans = min(ans, solve(2, a + d + c - b, det))
    if solve(2, a + d - c + b, det)!= -10**27:
        ans = min(ans, solve(2, a + d - c + b, det))
    if solve(-2, -a + d - c - b, det)!= -10**27:
        ans = min(ans, solve(-2, -a + d - c - b, det))
    if solve(-2, a - d - c - b, det)!= -10**27:
        ans = min(ans, solve(-2, a - d - c - b, det))
    if solve(-2, -a + d + c + b, det)!= -10**27:
        ans = min(ans, solve(-2, -a + d + c + b, det))
    if solve(-2, a - d + c + b, det)!= -10**27:
        ans = min(ans, solve(-2, a - d + c + b, det))
    print(ans)




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-8:
        if answer == None:
            answer = le
        else:
            answer = min(answer, le)

print(answer)


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)

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()


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**-9*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)

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**-9*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)

__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**.5)/2*x), abs((-y - disi**.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)




a, b= list(map(int, input().split()))
c, d = list(map(int, input().split()))
if a * d - b * c == 0:
    print(0)
else:
    curpos = a * d - b * c >= 0
    small = 0;
    large = 1e18
    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, b = map(int, input().split())
c, d = map(int, input().split())

z = a * d - b * c
if z == 0:
    print(0)
    return
t = max(abs(a + b + c + d), abs(a + d - c - b), abs(a + c - b - d), abs(a + b - c - d))
print(abs(z / t))

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)
    return float("inf")

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:
    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 = [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 sys
A, B, C, D = [int(i) for i in sys.stdin.read().split()]
if A == 0 and B == 0 and C == 0 and D == 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))


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(hi))

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))

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()

    # the problem intend was to use some optimization / binary search, but a
    # deterministic solution has been proposed and is used here.  idea: given
    # A, the matrix B is same as A, with +/-x at every element (plus/minus
    # depend on the signs of A elements. It's easiest to compute all possible
    # cases (only 4). Then, we can formulate the equation for the determinant
    # of this B, and set it to 0.
    # This leads to:
    #
    # det(B) == 0 == ad-bc-x(a+b+c+d)+x^2-x^2 == ad-bc-x(a+b+c+d)+x^2-x^2
    #
    # since the first two terms are the determinant of A, and the last two go
    # away, we get:
    #
    # 0 == det(A) - x(a+b+c+d)  <==>   x=det(A)/(a+b+c+d)
    #
    # after taking care of the other signs, one gets other potential solutions
    # below.
    #
    # However, as has been noted, it has not been proven that this is the
    # optimal solution. But it seems to be.

    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())
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)

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
        #print(left, m, right)
    return m

print(binSearch(10**-10, 2 * 10**9, a, b, c, d))


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 and square2[0][1] <= vert[1] * square2[0][0] / vert[0] <= square2[1][1]:
            return True
        if vert[1] != 0 and square2[0][0] <= vert[0] * square2[0][1] / vert[1] <= square2[3][0]:
            return True
        if vert[0] != 0 and square2[3][1] <= vert[1] * square2[2][0] / vert[0] <= square2[2][1]:
            return True
        if vert[1] != 0 and square2[1][0] <= vert[0] * square2[1][1] / vert[1] <= square2[2][0]:
            return True
    for vert in square2:
        if vert[0] != 0 and square1[0][1] <= vert[1] * square1[0][0] / vert[0] <= square1[1][1]:
            return True
        if vert[1] != 0 and square1[0][0] <= vert[0] * square1[0][1] / vert[1] <= square1[3][0]:
            return True
        if vert[0] != 0 and square1[3][1] <= vert[1] * square1[2][0] / vert[0]<= square1[2][1]:
            return True
        if vert[1] != 0 and 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
        #print(left, m, right)
    return m

print(binSearch(10**-10, 2 * 10**9, a, b, c, d))


a, b = map(int, input().split())
c, d = map(int, input().split())

z = a * d - b * c
if z == 0:
    print(0)
    return
t = max(abs(a + b + c + d), abs(a + d - c - b), abs(a + c - b - d), abs(a + b - c - d))
print(abs(z / t))

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))