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

def f(n):
    # F(0, n)
    if n % 2 == 0:
        if (n//2) % 2 == 0:
            return 0^n
        else:
            return 1^n
    else:
        if ((n+1)//2) % 2 == 0:
            return 0
        else:
            return 1

print(f(A-1)^f(B)) A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B ans = 0 ans 0 def f(n):
    # F(0, n)
    if n % 2 == 0:
        if (n//2) % 2 == 0:
            return 0^n
        else:
            return 1^n
    else:
        if ((n+1)//2) % 2 == 0:
            return 0
        else:
            return 1 f if n % 2 == 0:
        if (n//2) % 2 == 0:
            return 0^n
        else:
            return 1^n
    else:
        if ((n+1)//2) % 2 == 0:
            return 0
        else:
            return 1 n % 2 == 0 n % 2 n 2 0 if (n//2) % 2 == 0:
            return 0^n
        else:
            return 1^n
     (n//2) % 2 == 0 (n//2) % 2 n//2 n 2 2 0 return 0^n 0^n 0 n return 1^n 1^n 1 n if ((n+1)//2) % 2 == 0:
            return 0
        else:
            return 1 ((n+1)//2) % 2 == 0 ((n+1)//2) % 2 (n+1)//2 n+1 n 1 2 2 0 return 0 0 return 1 1 n n print(f(A-1)^f(B)) print f(A-1)^f(B) f(A-1) f A-1 A 1 f(B) f B B = map(int, input().split()) map(int, input().split()) B A, B = map(int, input().split()) map(int, input().split()) A ans = 0 0 ans def f(n):
    # F(0, n)
    if n % 2 == 0:
        if (n//2) % 2 == 0:
            return 0^n
        else:
            return 1^n
    else:
        if ((n+1)//2) % 2 == 0:
            return 0
        else:
            return 1 def f(n):
    # F(0, n)
    if n % 2 == 0:
        if (n//2) % 2 == 0:
            return 0^n
        else:
            return 1^n
    else:
        if ((n+1)//2) % 2 == 0:
            return 0
        else:
            return 1 f
A, B = map(int, input().split())
ans = 0

def f(n):
    # F(0, n)
    if n % 2 == 0:
        if (n//2) % 2 == 0:
            return 0^n
        else:
            return 1^n
    else:
        if ((n+1)//2) % 2 == 0:
            return 0
        else:
            return 1

print(f(A-1)^f(B))