import numpy as np

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

# bins = np.array([i for i in range(A, B+1)], dtype='int64')
if A % 2 == 0:
    if B % 2 == 0:
        # 偶偶
        if ((B - A) / 2) % 2 == 0:
            print(int(bin(B ^ 0), 2))
        else:
            print(int(bin(B ^ 1), 2))
    else:
        # 偶奇
        if ((B - A + 1) / 2) % 2 == 0:
            print(0)
        else:
            print(1)
else:
    if B % 2 == 0:
        # 奇遇
        if ((B-A-1) / 2) % 2 == 0:
            print(int(bin(B ^ A), 2))
        else:
            print(int(bin(B ^ A ^ 1), 2))
    else:
        # 奇奇
        if ((B-A) / 2) % 2 == 0:
            print(A)
        else:
            print(A ^ 1) import numpy as np numpy A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B if A % 2 == 0:
    if B % 2 == 0:
        # 偶偶
        if ((B - A) / 2) % 2 == 0:
            print(int(bin(B ^ 0), 2))
        else:
            print(int(bin(B ^ 1), 2))
    else:
        # 偶奇
        if ((B - A + 1) / 2) % 2 == 0:
            print(0)
        else:
            print(1)
else:
    if B % 2 == 0:
        # 奇遇
        if ((B-A-1) / 2) % 2 == 0:
            print(int(bin(B ^ A), 2))
        else:
            print(int(bin(B ^ A ^ 1), 2))
    else:
        # 奇奇
        if ((B-A) / 2) % 2 == 0:
            print(A)
        else:
            print(A ^ 1) A % 2 == 0 A % 2 A 2 0 if B % 2 == 0:
        # 偶偶
        if ((B - A) / 2) % 2 == 0:
            print(int(bin(B ^ 0), 2))
        else:
            print(int(bin(B ^ 1), 2))
    else:
        # 偶奇
        if ((B - A + 1) / 2) % 2 == 0:
            print(0)
        else:
            print(1) B % 2 == 0 B % 2 B 2 0 if ((B - A) / 2) % 2 == 0:
            print(int(bin(B ^ 0), 2))
        else:
            print(int(bin(B ^ 1), 2))
     ((B - A) / 2) % 2 == 0 ((B - A) / 2) % 2 (B - A) / 2 B - A B A 2 2 0 print(int(bin(B ^ 0), 2)) print int(bin(B ^ 0), 2) int bin(B ^ 0) bin B ^ 0 B 0 2 print(int(bin(B ^ 1), 2)) print int(bin(B ^ 1), 2) int bin(B ^ 1) bin B ^ 1 B 1 2 if ((B - A + 1) / 2) % 2 == 0:
            print(0)
        else:
            print(1) ((B - A + 1) / 2) % 2 == 0 ((B - A + 1) / 2) % 2 (B - A + 1) / 2 B - A + 1 B - A B A 1 2 2 0 print(0) print 0 print(1) print 1 if B % 2 == 0:
        # 奇遇
        if ((B-A-1) / 2) % 2 == 0:
            print(int(bin(B ^ A), 2))
        else:
            print(int(bin(B ^ A ^ 1), 2))
    else:
        # 奇奇
        if ((B-A) / 2) % 2 == 0:
            print(A)
        else:
            print(A ^ 1) B % 2 == 0 B % 2 B 2 0 if ((B-A-1) / 2) % 2 == 0:
            print(int(bin(B ^ A), 2))
        else:
            print(int(bin(B ^ A ^ 1), 2))
     ((B-A-1) / 2) % 2 == 0 ((B-A-1) / 2) % 2 (B-A-1) / 2 B-A-1 B-A B A 1 2 2 0 print(int(bin(B ^ A), 2)) print int(bin(B ^ A), 2) int bin(B ^ A) bin B ^ A B A 2 print(int(bin(B ^ A ^ 1), 2)) print int(bin(B ^ A ^ 1), 2) int bin(B ^ A ^ 1) bin B ^ A ^ 1 B ^ A B A 1 2 if ((B-A) / 2) % 2 == 0:
            print(A)
        else:
            print(A ^ 1) ((B-A) / 2) % 2 == 0 ((B-A) / 2) % 2 (B-A) / 2 B-A B A 2 2 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
import numpy as np

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

# bins = np.array([i for i in range(A, B+1)], dtype='int64')
if A % 2 == 0:
    if B % 2 == 0:
        # 偶偶
        if ((B - A) / 2) % 2 == 0:
            print(int(bin(B ^ 0), 2))
        else:
            print(int(bin(B ^ 1), 2))
    else:
        # 偶奇
        if ((B - A + 1) / 2) % 2 == 0:
            print(0)
        else:
            print(1)
else:
    if B % 2 == 0:
        # 奇遇
        if ((B-A-1) / 2) % 2 == 0:
            print(int(bin(B ^ A), 2))
        else:
            print(int(bin(B ^ A ^ 1), 2))
    else:
        # 奇奇
        if ((B-A) / 2) % 2 == 0:
            print(A)
        else:
            print(A ^ 1)
