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

if A == B:
    print(A)
else:
    A -= 1
    ans = 0
    a = 1
    b = 1
    if ((A+1)//2) % 2 == 1:
        if A % 2 == 0:
            a = 1 ^ A
        else:
            a = 1
    else:
        if A % 2 == 1:
            a = 0
        else:
            a = A

    if ((B+1)//2) % 2 == 1:
        if B % 2 == 0:
            b = 1 ^ B
        else:
            b = 1
    else:
        if B % 2 == 1:
            b = 0
        else:
            b = B

    print(a ^ b) 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
    ans = 0
    a = 1
    b = 1
    if ((A+1)//2) % 2 == 1:
        if A % 2 == 0:
            a = 1 ^ A
        else:
            a = 1
    else:
        if A % 2 == 1:
            a = 0
        else:
            a = A

    if ((B+1)//2) % 2 == 1:
        if B % 2 == 0:
            b = 1 ^ B
        else:
            b = 1
    else:
        if B % 2 == 1:
            b = 0
        else:
            b = B

    print(a ^ b) A == B A B print(A) print A A -= 1 A 1 ans = 0 ans 0 a = 1 a 1 b = 1 b 1 if ((A+1)//2) % 2 == 1:
        if A % 2 == 0:
            a = 1 ^ A
        else:
            a = 1
    else:
        if A % 2 == 1:
            a = 0
        else:
            a = A

     ((A+1)//2) % 2 == 1 ((A+1)//2) % 2 (A+1)//2 A+1 A 1 2 2 1 if A % 2 == 0:
            a = 1 ^ A
        else:
            a = 1
     A % 2 == 0 A % 2 A 2 0 a = 1 ^ A a 1 ^ A 1 A a = 1 a 1 if A % 2 == 1:
            a = 0
        else:
            a = A

     A % 2 == 1 A % 2 A 2 1 a = 0 a 0 a = A a A if ((B+1)//2) % 2 == 1:
        if B % 2 == 0:
            b = 1 ^ B
        else:
            b = 1
    else:
        if B % 2 == 1:
            b = 0
        else:
            b = B

     ((B+1)//2) % 2 == 1 ((B+1)//2) % 2 (B+1)//2 B+1 B 1 2 2 1 if B % 2 == 0:
            b = 1 ^ B
        else:
            b = 1
     B % 2 == 0 B % 2 B 2 0 b = 1 ^ B b 1 ^ B 1 B b = 1 b 1 if B % 2 == 1:
            b = 0
        else:
            b = B

     B % 2 == 1 B % 2 B 2 1 b = 0 b 0 b = B b B print(a ^ b) print a ^ b a b b = 1 ^ B 1 ^ B b b = 1 1 b b = 1 1 b B = map(int, input().split()) map(int, input().split()) B a = 0 0 a A -= 1 1 A a = 1 1 a a = 1 1 a ans = 0 0 ans A, B = map(int, input().split()) map(int, input().split()) A a = A A a b = 0 0 b b = B B b a = 1 ^ A 1 ^ A a
A, B = map(int, input().split())

if A == B:
    print(A)
else:
    A -= 1
    ans = 0
    a = 1
    b = 1
    if ((A+1)//2) % 2 == 1:
        if A % 2 == 0:
            a = 1 ^ A
        else:
            a = 1
    else:
        if A % 2 == 1:
            a = 0
        else:
            a = A

    if ((B+1)//2) % 2 == 1:
        if B % 2 == 0:
            b = 1 ^ B
        else:
            b = 1
    else:
        if B % 2 == 1:
            b = 0
        else:
            b = B

    print(a ^ b)
