# D - XOR World

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

def rangeXOR(x, y):
    ret = x
    for i in range(x+1, y+1):
        ret ^= i
    return ret

left = rangeXOR(A, A+(3-A%4))
right = rangeXOR(B-(B%4), B)
    
if left==0:
    print(right)
elif right==0:
    print(left)
else:
    print(left^right) A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B def rangeXOR(x, y):
    ret = x
    for i in range(x+1, y+1):
        ret ^= i
    return ret rangeXOR ret = x ret x for i in range(x+1, y+1):
        ret ^= i
     i range(x+1, y+1) range x+1 x 1 y+1 y 1 ret ^= i ret i return ret ret x x y y left = rangeXOR(A, A+(3-A%4)) left rangeXOR(A, A+(3-A%4)) rangeXOR A A+(3-A%4) A 3-A%4 3 A%4 A 4 right = rangeXOR(B-(B%4), B) right rangeXOR(B-(B%4), B) rangeXOR B-(B%4) B B%4 B 4 B if left==0:
    print(right)
elif right==0:
    print(left)
else:
    print(left^right) left==0 left 0 print(right) print right elif right==0:
    print(left) right==0 right 0 print(left) print left print(left^right) print left^right left right def rangeXOR(x, y):
    ret = x
    for i in range(x+1, y+1):
        ret ^= i
    return ret def rangeXOR(x, y):
    ret = x
    for i in range(x+1, y+1):
        ret ^= i
    return ret rangeXOR A, B = map(int, input().split()) map(int, input().split()) A B = map(int, input().split()) map(int, input().split()) B right = rangeXOR(B-(B%4), B) rangeXOR(B-(B%4), B) right left = rangeXOR(A, A+(3-A%4)) rangeXOR(A, A+(3-A%4)) left
# D - XOR World

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

def rangeXOR(x, y):
    ret = x
    for i in range(x+1, y+1):
        ret ^= i
    return ret

left = rangeXOR(A, A+(3-A%4))
right = rangeXOR(B-(B%4), B)
    
if left==0:
    print(right)
elif right==0:
    print(left)
else:
    print(left^right)