#!/usr/bin/env python3
import sys


def f(n):
    '''
    >>> f(1)
    1
    >>> f(6)
    7
    '''
    return (0 if n % 2 else n) ^ (1 if (n+1) // 2 % 2 else 0)


def solve(A: int, B: int):
    return f(A-1) ^ f(B)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    print(solve(A, B))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    test()
    main() import sys sys def f(n):
    '''
    >>> f(1)
    1
    >>> f(6)
    7
    '''
    return (0 if n % 2 else n) ^ (1 if (n+1) // 2 % 2 else 0) f '''
    >>> f(1)
    1
    >>> f(6)
    7
    ''' return (0 if n % 2 else n) ^ (1 if (n+1) // 2 % 2 else 0) (0 if n % 2 else n) ^ (1 if (n+1) // 2 % 2 else 0) 0 if n % 2 else n n % 2 n 2 0 n 1 if (n+1) // 2 % 2 else 0 (n+1) // 2 % 2 (n+1) // 2 n+1 n 1 2 2 1 0 n n def solve(A: int, B: int):
    return f(A-1) ^ f(B)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools solve return f(A-1) ^ f(B) f(A-1) ^ f(B) f(A-1) f A-1 A 1 f(B) f B A: int A B: int B def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    print(solve(A, B)) main def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
     iterate_tokens for line in sys.stdin:
            for word in line.split():
                yield word
     line sys.stdin sys stdin for word in line.split():
                yield word
     word line.split() line.split line split yield word word tokens = iterate_tokens() tokens iterate_tokens() iterate_tokens A = int(next(tokens)) A int(next(tokens)) int next(tokens) next tokens B = int(next(tokens)) B int(next(tokens)) int next(tokens) next tokens print(solve(A, B)) print solve(A, B) solve A B def test():
    import doctest
    doctest.testmod() test import doctest doctest doctest.testmod() doctest.testmod doctest testmod if __name__ == '__main__':
    test()
    main() __name__ == '__main__' __name__ '__main__' test() test main() main def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    print(solve(A, B)) def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    print(solve(A, B)) main def solve(A: int, B: int):
    return f(A-1) ^ f(B)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools def solve(A: int, B: int):
    return f(A-1) ^ f(B)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools solve def test():
    import doctest
    doctest.testmod() def test():
    import doctest
    doctest.testmod() test def f(n):
    '''
    >>> f(1)
    1
    >>> f(6)
    7
    '''
    return (0 if n % 2 else n) ^ (1 if (n+1) // 2 % 2 else 0) def f(n):
    '''
    >>> f(1)
    1
    >>> f(6)
    7
    '''
    return (0 if n % 2 else n) ^ (1 if (n+1) // 2 % 2 else 0) f
#!/usr/bin/env python3
import sys


def f(n):
    '''
    >>> f(1)
    1
    >>> f(6)
    7
    '''
    return (0 if n % 2 else n) ^ (1 if (n+1) // 2 % 2 else 0)


def solve(A: int, B: int):
    return f(A-1) ^ f(B)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    print(solve(A, B))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    test()
    main()
