H, W = map(int, input().split()) if H == 0 or W == 0: print(0) else: W = abs(W) if H >= W: print(H + (W - 1)) else: print(2 * W - 1)