A,B=[int(x) for x in input().split()]

if A==B:
	print(A)
	exit()

if A%2==1 and B%2==1:
	even=(B-A)//2
else:
	even=(B-A)//2+1

if even%2==0:	
	if A%2==1 and B%2==0:
		print(A^B^1)
	elif A%2==1 and B%2==1:
		print(A)
	elif A%2==0 and B%2==1:
		print(0)
	elif A%2==0 and B%2==0:
		print(B^1)
else:
	if A%2==1 and B%2==0:
		print(A^B)
	elif A%2==1 and B%2==1:
		print(A^1)
	elif A%2==0 and B%2==1:
		print(1)
	elif A%2==0 and B%2==0:
		print(B) int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x A,B=[int(x) for x in input().split()] A [int(x) for x in input().split()] B if A==B:
	print(A)
	exit() A==B A B print(A) print A exit() exit if A%2==1 and B%2==1:
	even=(B-A)//2
else:
	even=(B-A)//2+1 A%2==1 and B%2==1 A%2==1 A%2 A 2 1 B%2==1 B%2 B 2 1 even=(B-A)//2 even (B-A)//2 B-A B A 2 even=(B-A)//2+1 even (B-A)//2+1 (B-A)//2 B-A B A 2 1 if even%2==0:	
	if A%2==1 and B%2==0:
		print(A^B^1)
	elif A%2==1 and B%2==1:
		print(A)
	elif A%2==0 and B%2==1:
		print(0)
	elif A%2==0 and B%2==0:
		print(B^1)
else:
	if A%2==1 and B%2==0:
		print(A^B)
	elif A%2==1 and B%2==1:
		print(A^1)
	elif A%2==0 and B%2==1:
		print(1)
	elif A%2==0 and B%2==0:
		print(B) even%2==0 even%2 even 2 0 if A%2==1 and B%2==0:
		print(A^B^1)
	elif A%2==1 and B%2==1:
		print(A)
	elif A%2==0 and B%2==1:
		print(0)
	elif A%2==0 and B%2==0:
		print(B^1) A%2==1 and B%2==0 A%2==1 A%2 A 2 1 B%2==0 B%2 B 2 0 print(A^B^1) print A^B^1 A^B A B 1 elif A%2==1 and B%2==1:
		print(A)
	 A%2==1 and B%2==1 A%2==1 A%2 A 2 1 B%2==1 B%2 B 2 1 print(A) print A elif A%2==0 and B%2==1:
		print(0)
	 A%2==0 and B%2==1 A%2==0 A%2 A 2 0 B%2==1 B%2 B 2 1 print(0) print 0 elif A%2==0 and B%2==0:
		print(B^1) A%2==0 and B%2==0 A%2==0 A%2 A 2 0 B%2==0 B%2 B 2 0 print(B^1) print B^1 B 1 if A%2==1 and B%2==0:
		print(A^B)
	elif A%2==1 and B%2==1:
		print(A^1)
	elif A%2==0 and B%2==1:
		print(1)
	elif A%2==0 and B%2==0:
		print(B) A%2==1 and B%2==0 A%2==1 A%2 A 2 1 B%2==0 B%2 B 2 0 print(A^B) print A^B A B elif A%2==1 and B%2==1:
		print(A^1)
	 A%2==1 and B%2==1 A%2==1 A%2 A 2 1 B%2==1 B%2 B 2 1 print(A^1) print A^1 A 1 elif A%2==0 and B%2==1:
		print(1)
	 A%2==0 and B%2==1 A%2==0 A%2 A 2 0 B%2==1 B%2 B 2 1 print(1) print 1 elif A%2==0 and B%2==0:
		print(B) A%2==0 and B%2==0 A%2==0 A%2 A 2 0 B%2==0 B%2 B 2 0 print(B) print B A,B=[int(x) for x in input().split()] [int(x) for x in input().split()] A even=(B-A)//2+1 (B-A)//2+1 even B=[int(x) for x in input().split()] [int(x) for x in input().split()] B even=(B-A)//2 (B-A)//2 even
A,B=[int(x) for x in input().split()]

if A==B:
	print(A)
	exit()

if A%2==1 and B%2==1:
	even=(B-A)//2
else:
	even=(B-A)//2+1

if even%2==0:	
	if A%2==1 and B%2==0:
		print(A^B^1)
	elif A%2==1 and B%2==1:
		print(A)
	elif A%2==0 and B%2==1:
		print(0)
	elif A%2==0 and B%2==0:
		print(B^1)
else:
	if A%2==1 and B%2==0:
		print(A^B)
	elif A%2==1 and B%2==1:
		print(A^1)
	elif A%2==0 and B%2==1:
		print(1)
	elif A%2==0 and B%2==0:
		print(B)