def main():
    A, B = map(int, input().split())

    def xor_world(k):
        """[0,k]"""
        r = k % 4
        if r == 0:
            return k
        elif r == 1:
            return 1
        elif r == 2:
            return 1 ^ k
        else:
            return 0

    ans = xor_world(B) ^ xor_world(A) ^ A
    print(ans)


if __name__ == '__main__':
    main() def main():
    A, B = map(int, input().split())

    def xor_world(k):
        """[0,k]"""
        r = k % 4
        if r == 0:
            return k
        elif r == 1:
            return 1
        elif r == 2:
            return 1 ^ k
        else:
            return 0

    ans = xor_world(B) ^ xor_world(A) ^ A
    print(ans) main A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B def xor_world(k):
        """[0,k]"""
        r = k % 4
        if r == 0:
            return k
        elif r == 1:
            return 1
        elif r == 2:
            return 1 ^ k
        else:
            return 0

     xor_world """[0,k]""" r = k % 4 r k % 4 k 4 if r == 0:
            return k
        elif r == 1:
            return 1
        elif r == 2:
            return 1 ^ k
        else:
            return 0

     r == 0 r 0 return k k elif r == 1:
            return 1
         r == 1 r 1 return 1 1 elif r == 2:
            return 1 ^ k
         r == 2 r 2 return 1 ^ k 1 ^ k 1 k return 0 0 k k ans = xor_world(B) ^ xor_world(A) ^ A ans xor_world(B) ^ xor_world(A) ^ A xor_world(B) ^ xor_world(A) xor_world(B) xor_world B xor_world(A) xor_world A A print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    A, B = map(int, input().split())

    def xor_world(k):
        """[0,k]"""
        r = k % 4
        if r == 0:
            return k
        elif r == 1:
            return 1
        elif r == 2:
            return 1 ^ k
        else:
            return 0

    ans = xor_world(B) ^ xor_world(A) ^ A
    print(ans) def main():
    A, B = map(int, input().split())

    def xor_world(k):
        """[0,k]"""
        r = k % 4
        if r == 0:
            return k
        elif r == 1:
            return 1
        elif r == 2:
            return 1 ^ k
        else:
            return 0

    ans = xor_world(B) ^ xor_world(A) ^ A
    print(ans) main
def main():
    A, B = map(int, input().split())

    def xor_world(k):
        """[0,k]"""
        r = k % 4
        if r == 0:
            return k
        elif r == 1:
            return 1
        elif r == 2:
            return 1 ^ k
        else:
            return 0

    ans = xor_world(B) ^ xor_world(A) ^ A
    print(ans)


if __name__ == '__main__':
    main()
