a, b = map(int, input().split())
if a == b:
    print(a)
else:
    a -= 1
    if a%2 == 0:
        fa = (a//2)%2 ^ a
    else:
        fa = ((a+1)//2)%2
    if b%2 == 0:
        fb = (b//2)%2 ^ b
    else:
        fb = ((b+1)//2)%2
    print(fb ^ fa) a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b if a == b:
    print(a)
else:
    a -= 1
    if a%2 == 0:
        fa = (a//2)%2 ^ a
    else:
        fa = ((a+1)//2)%2
    if b%2 == 0:
        fb = (b//2)%2 ^ b
    else:
        fb = ((b+1)//2)%2
    print(fb ^ fa) a == b a b print(a) print a a -= 1 a 1 if a%2 == 0:
        fa = (a//2)%2 ^ a
    else:
        fa = ((a+1)//2)%2
     a%2 == 0 a%2 a 2 0 fa = (a//2)%2 ^ a fa (a//2)%2 ^ a (a//2)%2 a//2 a 2 2 a fa = ((a+1)//2)%2 fa ((a+1)//2)%2 (a+1)//2 a+1 a 1 2 2 if b%2 == 0:
        fb = (b//2)%2 ^ b
    else:
        fb = ((b+1)//2)%2
     b%2 == 0 b%2 b 2 0 fb = (b//2)%2 ^ b fb (b//2)%2 ^ b (b//2)%2 b//2 b 2 2 b fb = ((b+1)//2)%2 fb ((b+1)//2)%2 (b+1)//2 b+1 b 1 2 2 print(fb ^ fa) print fb ^ fa fb fa fb = (b//2)%2 ^ b (b//2)%2 ^ b fb a, b = map(int, input().split()) map(int, input().split()) a b = map(int, input().split()) map(int, input().split()) b fa = ((a+1)//2)%2 ((a+1)//2)%2 fa fb = ((b+1)//2)%2 ((b+1)//2)%2 fb fa = (a//2)%2 ^ a (a//2)%2 ^ a fa a -= 1 1 a
a, b = map(int, input().split())
if a == b:
    print(a)
else:
    a -= 1
    if a%2 == 0:
        fa = (a//2)%2 ^ a
    else:
        fa = ((a+1)//2)%2
    if b%2 == 0:
        fb = (b//2)%2 ^ b
    else:
        fb = ((b+1)//2)%2
    print(fb ^ fa)
