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