A, B, S = map(int, raw_input().split()) if abs(A-S) <= abs(B-S): print abs(A-S)+S else: print abs(B-S)+abs(A-S)+A+(A==0)