A,B = map(int,(input().split()))
def xor(n):
    if n%2 == 1:
        if (n+1)%4 == 0:
            return 0
        else:
            return 1
    else:
        if n%4 == 0:
            return n^0
        else:
            return n^1
            
print(xor(A-1)^xor(B)) A,B = map(int,(input().split())) A map(int,(input().split())) map int input().split() ().split () input split B def xor(n):
    if n%2 == 1:
        if (n+1)%4 == 0:
            return 0
        else:
            return 1
    else:
        if n%4 == 0:
            return n^0
        else:
            return n^1
             xor if n%2 == 1:
        if (n+1)%4 == 0:
            return 0
        else:
            return 1
    else:
        if n%4 == 0:
            return n^0
        else:
            return n^1
             n%2 == 1 n%2 n 2 1 if (n+1)%4 == 0:
            return 0
        else:
            return 1
     (n+1)%4 == 0 (n+1)%4 n+1 n 1 4 0 return 0 0 return 1 1 if n%4 == 0:
            return n^0
        else:
            return n^1
             n%4 == 0 n%4 n 4 0 return n^0 n^0 n 0 return n^1 n^1 n 1 n n print(xor(A-1)^xor(B)) print xor(A-1)^xor(B) xor(A-1) xor A-1 A 1 xor(B) xor B A,B = map(int,(input().split())) map(int,(input().split())) A def xor(n):
    if n%2 == 1:
        if (n+1)%4 == 0:
            return 0
        else:
            return 1
    else:
        if n%4 == 0:
            return n^0
        else:
            return n^1
             def xor(n):
    if n%2 == 1:
        if (n+1)%4 == 0:
            return 0
        else:
            return 1
    else:
        if n%4 == 0:
            return n^0
        else:
            return n^1
             xor B = map(int,(input().split())) map(int,(input().split())) B
A,B = map(int,(input().split()))
def xor(n):
    if n%2 == 1:
        if (n+1)%4 == 0:
            return 0
        else:
            return 1
    else:
        if n%4 == 0:
            return n^0
        else:
            return n^1
            
print(xor(A-1)^xor(B))