a, b, s = map(int,input().split()) if abs(a-s) <= abs(b-s): print(abs(a-s)+s) else: print(abs(b-s)+s+a)