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

a.sort()

if (a[1]-a[0]) % 2 == 0:

    print(((a[1]-a[0])//2 + (a[2]-a[1])))

else:

    print(((a[2]-a[1])//2 + (a[2]-a[1])%2 + (a[2]-a[0]+1)//2 + 1))    
a = list(map(int,input().split()))

M = max(a)

if (3 * M - sum(a))%2 == 0:

    print(((3 * M - sum(a))//2))

else:

    print(((3 * (M+1) - sum(a))//2))
a = list(map(int, input().split()))
a.sort()
if (a[1] - a[0]) % 2 == 0:
    print(((a[1] - a[0]) // 2 + (a[2] - a[1])))
else:
    print(((a[2] - a[1]) // 2 + (a[2] - a[1]) % 2 + (a[2] - a[0] + 1) // 2 + 1))

a = list(map(int, input().split()))
M = max(a)
if (3 * M - sum(a)) % 2 == 0:
    print(((3 * M - sum(a)) // 2))
else:
    print(((3 * (M + 1) - sum(a)) // 2))

-a.sort() -if (a[1] - a[0]) % 2 == 0: -    print(((a[1] - a[0]) // 2 + (a[2] - a[1]))) +M = max(a) +if (3 * M - sum(a)) % 2 == 0: +    print(((3 * M - sum(a)) // 2)) -    print(((a[2] - a[1]) // 2 + (a[2] - a[1]) % 2 + (a[2] - a[0] + 1) // 2 + 1)) +    print(((3 * (M + 1) - sum(a)) // 2))