import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    def f(x):
        r = (x + 1) % 4
        ans = 0
        for n in range(x, x - r, -1):
            ans ^= n
        return ans

    if A == 0:
        print(f(B))
    else:
        print(f(B) ^ f(A - 1))

    return


if __name__ == '__main__':
    main() import sys sys read = sys.stdin.read read sys.stdin.read sys.stdin sys stdin read readline = sys.stdin.readline readline sys.stdin.readline sys.stdin sys stdin readline readlines = sys.stdin.readlines readlines sys.stdin.readlines sys.stdin sys stdin readlines sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 INF = 1 << 60 INF 1 << 60 1 60 MOD = 1000000007 MOD 1000000007 def main():
    A, B = map(int, readline().split())

    def f(x):
        r = (x + 1) % 4
        ans = 0
        for n in range(x, x - r, -1):
            ans ^= n
        return ans

    if A == 0:
        print(f(B))
    else:
        print(f(B) ^ f(A - 1))

    return main A, B = map(int, readline().split()) A map(int, readline().split()) map int readline().split() ().split () readline split B def f(x):
        r = (x + 1) % 4
        ans = 0
        for n in range(x, x - r, -1):
            ans ^= n
        return ans

     f r = (x + 1) % 4 r (x + 1) % 4 x + 1 x 1 4 ans = 0 ans 0 for n in range(x, x - r, -1):
            ans ^= n
         n range(x, x - r, -1) range x x - r x r -1 ans ^= n ans n return ans ans x x if A == 0:
        print(f(B))
    else:
        print(f(B) ^ f(A - 1))

     A == 0 A 0 print(f(B)) print f(B) f B print(f(B) ^ f(A - 1)) print f(B) ^ f(A - 1) f(B) f B f(A - 1) f A - 1 A 1 return if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main readlines = sys.stdin.readlines sys.stdin.readlines readlines readline = sys.stdin.readline sys.stdin.readline readline def main():
    A, B = map(int, readline().split())

    def f(x):
        r = (x + 1) % 4
        ans = 0
        for n in range(x, x - r, -1):
            ans ^= n
        return ans

    if A == 0:
        print(f(B))
    else:
        print(f(B) ^ f(A - 1))

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

    def f(x):
        r = (x + 1) % 4
        ans = 0
        for n in range(x, x - r, -1):
            ans ^= n
        return ans

    if A == 0:
        print(f(B))
    else:
        print(f(B) ^ f(A - 1))

    return main INF = 1 << 60 1 << 60 INF read = sys.stdin.read sys.stdin.read read MOD = 1000000007 1000000007 MOD
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    def f(x):
        r = (x + 1) % 4
        ans = 0
        for n in range(x, x - r, -1):
            ans ^= n
        return ans

    if A == 0:
        print(f(B))
    else:
        print(f(B) ^ f(A - 1))

    return


if __name__ == '__main__':
    main()
