#131 manhattann distance x,y,d=(int(i) for i in input().split()) if x>y: m=y else: m=x if m*2i: print(i) else: m*=2 print(m-i+1)