A, B = map(int, input().split())

if (A%2==0) and (B%2==0):
  if (B-A) % 4 == 0:
    print(B)
  else:
    print(B+1)
elif (A%2==0) and (B%2==1):
  if (B-A+1) % 4 == 0:
    print(0)
  else:
    print(1)
elif (A%2==1) and (B%2==0):
  if (B-A-1) % 4 == 0:
    print(A^B)
  else:
    print(A^B^1)
else:
  if (B-A) % 4 == 0:
    print(A)
  else:
    print(A^1) A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B if (A%2==0) and (B%2==0):
  if (B-A) % 4 == 0:
    print(B)
  else:
    print(B+1)
elif (A%2==0) and (B%2==1):
  if (B-A+1) % 4 == 0:
    print(0)
  else:
    print(1)
elif (A%2==1) and (B%2==0):
  if (B-A-1) % 4 == 0:
    print(A^B)
  else:
    print(A^B^1)
else:
  if (B-A) % 4 == 0:
    print(A)
  else:
    print(A^1) (A%2==0) and (B%2==0) A%2==0 A%2 A 2 0 B%2==0 B%2 B 2 0 if (B-A) % 4 == 0:
    print(B)
  else:
    print(B+1) (B-A) % 4 == 0 (B-A) % 4 B-A B A 4 0 print(B) print B print(B+1) print B+1 B 1 elif (A%2==0) and (B%2==1):
  if (B-A+1) % 4 == 0:
    print(0)
  else:
    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 if (B-A+1) % 4 == 0:
    print(0)
  else:
    print(1) (B-A+1) % 4 == 0 (B-A+1) % 4 B-A+1 B-A B A 1 4 0 print(0) print 0 print(1) print 1 elif (A%2==1) and (B%2==0):
  if (B-A-1) % 4 == 0:
    print(A^B)
  else:
    print(A^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 if (B-A-1) % 4 == 0:
    print(A^B)
  else:
    print(A^B^1) (B-A-1) % 4 == 0 (B-A-1) % 4 B-A-1 B-A B A 1 4 0 print(A^B) print A^B A B print(A^B^1) print A^B^1 A^B A B 1 if (B-A) % 4 == 0:
    print(A)
  else:
    print(A^1) (B-A) % 4 == 0 (B-A) % 4 B-A B A 4 0 print(A) print A print(A^1) print A^1 A 1 B = map(int, input().split()) map(int, input().split()) B A, B = map(int, input().split()) map(int, input().split()) A
A, B = map(int, input().split())

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