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