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