*I,=list(map(int, input().split()))

sm=sum(I)

mx=max(I)

h=(3*mx-sm)

print((h//2 if h&1==0 else (h+3)//2))
*i, = list(map(int, input().split()))

mx = max(i)

sm = sum(i)

print(((3 * mx - sm) // 2 if (mx + sm) % 2 == 0 else (3 * mx + 3 - sm) // 2))

(*I,) = list(map(int, input().split()))
sm = sum(I)
mx = max(I)
h = 3 * mx - sm
print((h // 2 if h & 1 == 0 else (h + 3) // 2))

(*i,) = list(map(int, input().split()))
mx = max(i)
sm = sum(i)
print(((3 * mx - sm) // 2 if (mx + sm) % 2 == 0 else (3 * mx + 3 - sm) // 2))

-(*I,) = list(map(int, input().split())) -sm = sum(I) -mx = max(I) -h = 3 * mx - sm -print((h // 2 if h & 1 == 0 else (h + 3) // 2)) +(*i,) = list(map(int, input().split())) +mx = max(i) +sm = sum(i) +print(((3 * mx - sm) // 2 if (mx + sm) % 2 == 0 else (3 * mx + 3 - sm) // 2))