A,B,C,D = list(map(int,input().split()))

AC = max(A,C)

BD = min(B,D)

flag = (BD-AC) <= 0

if flag:

  print((0))

else:

  print((BD-AC))

A,B,C,D = list(map(int,input().split()))

AC = max(A,C)

BD = min(B,D)

if (BD-AC) <= 0:

  print((0))

else:

  print((BD-AC))
A, B, C, D = list(map(int, input().split()))
AC = max(A, C)
BD = min(B, D)
flag = (BD - AC) <= 0
if flag:
    print((0))
else:
    print((BD - AC))

A, B, C, D = list(map(int, input().split()))
AC = max(A, C)
BD = min(B, D)
if (BD - AC) <= 0:
    print((0))
else:
    print((BD - AC))

-flag = (BD - AC) <= 0 -if flag: +if (BD - AC) <= 0: