s=0
A,B=map(int,input().split())
if abs(A-B)<30:
  for i in range(A,B+1):
    s=s^i
  print(s)
else:
  c=A//4
  L=range(A,4*(c+1))
  for i in L:
    s=s^i
  c=B//4
  L=range(4*(c-1),B+1)
  for i in L:
    s=s^i
  print(s) s=0 s 0 A,B=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B if abs(A-B)<30:
  for i in range(A,B+1):
    s=s^i
  print(s)
else:
  c=A//4
  L=range(A,4*(c+1))
  for i in L:
    s=s^i
  c=B//4
  L=range(4*(c-1),B+1)
  for i in L:
    s=s^i
  print(s) abs(A-B)<30 abs(A-B) abs A-B A B 30 for i in range(A,B+1):
    s=s^i
   i range(A,B+1) range A B+1 B 1 s=s^i s s^i s i print(s) print s c=A//4 c A//4 A 4 L=range(A,4*(c+1)) L range(A,4*(c+1)) range A 4*(c+1) 4 c+1 c 1 for i in L:
    s=s^i
   i L s=s^i s s^i s i c=B//4 c B//4 B 4 L=range(4*(c-1),B+1) L range(4*(c-1),B+1) range 4*(c-1) 4 c-1 c 1 B+1 B 1 for i in L:
    s=s^i
   i L s=s^i s s^i s i print(s) print s A,B=map(int,input().split()) map(int,input().split()) A c=A//4 A//4 c L=range(4*(c-1),B+1) range(4*(c-1),B+1) L c=B//4 B//4 c B=map(int,input().split()) map(int,input().split()) B s=s^i s^i s L=range(A,4*(c+1)) range(A,4*(c+1)) L s=s^i s^i s s=0 0 s s=s^i s^i s
s=0
A,B=map(int,input().split())
if abs(A-B)<30:
  for i in range(A,B+1):
    s=s^i
  print(s)
else:
  c=A//4
  L=range(A,4*(c+1))
  for i in L:
    s=s^i
  c=B//4
  L=range(4*(c-1),B+1)
  for i in L:
    s=s^i
  print(s)