import sys
def doit(input):
rows = input.strip().split("\n")
sum = 0
for r in rows:
vals = list(map(int,r.strip().split()))
min = 2**32
max = 0
for v in vals:
if v < min: min = v
if v > max: max = v
diff = max - min
sum += diff
return "%d" % sum
input = sys.stdin.read()
print(doit(input))