import sys
for s in sys.stdin:
length = len(s) # s = 263541
#5
A=0
B=0
# if input = 263541
# s = ['2', '6', '3', '5', '4', '1', '\n']
#length 7
#range(1,10,1) 1 2 3 4 5 6 7 8 9
for i in range(length-2, 0-1, -1): # 5~0
if i%2 ==0:
B += int(s[i])
else:
A += int(s[i])
sum = abs(A-B)
print(sum)