from sys import stdin
def main():
    #入力
    readline=stdin.readline
    a,b=map(int,readline().split())

    if a==0:
        print(f(b))
    else:
        print(f(b)^f(a-1))

def f(n):
    if n%4==3:
        return 0
    elif n%4==2:
        return n^1
    elif n%4==1:
        return 1
    else:
        return n

if __name__=="__main__":
    main() from sys import stdin def main():
    #入力
    readline=stdin.readline
    a,b=map(int,readline().split())

    if a==0:
        print(f(b))
    else:
        print(f(b)^f(a-1)) main readline=stdin.readline readline stdin.readline stdin readline a,b=map(int,readline().split()) a map(int,readline().split()) map int readline().split() ().split () readline split b 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 def f(n):
    if n%4==3:
        return 0
    elif n%4==2:
        return n^1
    elif n%4==1:
        return 1
    else:
        return n f if n%4==3:
        return 0
    elif n%4==2:
        return n^1
    elif n%4==1:
        return 1
    else:
        return n n%4==3 n%4 n 4 3 return 0 0 elif n%4==2:
        return n^1
     n%4==2 n%4 n 4 2 return n^1 n^1 n 1 elif n%4==1:
        return 1
     n%4==1 n%4 n 4 1 return 1 1 return n n n n if __name__=="__main__":
    main() __name__=="__main__" __name__ "__main__" main() main def f(n):
    if n%4==3:
        return 0
    elif n%4==2:
        return n^1
    elif n%4==1:
        return 1
    else:
        return n def f(n):
    if n%4==3:
        return 0
    elif n%4==2:
        return n^1
    elif n%4==1:
        return 1
    else:
        return n f def main():
    #入力
    readline=stdin.readline
    a,b=map(int,readline().split())

    if a==0:
        print(f(b))
    else:
        print(f(b)^f(a-1)) def main():
    #入力
    readline=stdin.readline
    a,b=map(int,readline().split())

    if a==0:
        print(f(b))
    else:
        print(f(b)^f(a-1)) main
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    a,b=map(int,readline().split())

    if a==0:
        print(f(b))
    else:
        print(f(b)^f(a-1))

def f(n):
    if n%4==3:
        return 0
    elif n%4==2:
        return n^1
    elif n%4==1:
        return 1
    else:
        return n

if __name__=="__main__":
    main()