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