a = list(map(int, input().split()))

r = max(a)

a.remove(max(a))

ans = 0

ans += abs(r - max(a)) + abs(a[0] - a[1])

print(ans)

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

l = [a ,b, c]

l.sort()

ans = []

p = l.pop()

ans.append(abs(p-l[0]) + abs(l[0]-l[1]))

ans.append(abs(p-l[1]) + abs(l[1]-l[0]))

print((min(ans)))
a = list(map(int, input().split()))
r = max(a)
a.remove(max(a))
ans = 0
ans += abs(r - max(a)) + abs(a[0] - a[1])
print(ans)

a, b, c = list(map(int, input().split()))
l = [a, b, c]
l.sort()
ans = []
p = l.pop()
ans.append(abs(p - l[0]) + abs(l[0] - l[1]))
ans.append(abs(p - l[1]) + abs(l[1] - l[0]))
print((min(ans)))

-a = list(map(int, input().split())) -r = max(a) -a.remove(max(a)) -ans = 0 -ans += abs(r - max(a)) + abs(a[0] - a[1]) -print(ans) +a, b, c = list(map(int, input().split())) +l = [a, b, c] +l.sort() +ans = [] +p = l.pop() +ans.append(abs(p - l[0]) + abs(l[0] - l[1])) +ans.append(abs(p - l[1]) + abs(l[1] - l[0])) +print((min(ans)))