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

s=max(a)*3-sum(a);print(([s//2+2,s//2][s%2<1]))
a,b,c=sorted(map(int,input().split()))

print((c-b+(b-a+1)//2+((b-a)&1)))
a = list(map(int, input().split()))
s = max(a) * 3 - sum(a)
print(([s // 2 + 2, s // 2][s % 2 < 1]))

a, b, c = sorted(map(int, input().split()))
print((c - b + (b - a + 1) // 2 + ((b - a) & 1)))

-a = list(map(int, input().split())) -s = max(a) * 3 - sum(a) -print(([s // 2 + 2, s // 2][s % 2 < 1])) +a, b, c = sorted(map(int, input().split())) +print((c - b + (b - a + 1) // 2 + ((b - a) & 1)))