def calc(x):
    if x % 4 == 1:
        return 1
    if x % 4 == 3:
        return 0
    
    if x % 4 == 2:
        return 1 + x
    else:
        return x


# 1,5,9,13,... => 1
# 3,7,11,15,... => 0
A, B = map(int, input().split())
x = calc(A - 1)
y = calc(B)
print(x ^ y) def calc(x):
    if x % 4 == 1:
        return 1
    if x % 4 == 3:
        return 0
    
    if x % 4 == 2:
        return 1 + x
    else:
        return x


# 1,5,9,13,... => 1
# 3,7,11,15,... => 0 calc if x % 4 == 1:
        return 1
     x % 4 == 1 x % 4 x 4 1 return 1 1 if x % 4 == 3:
        return 0
    
     x % 4 == 3 x % 4 x 4 3 return 0 0 if x % 4 == 2:
        return 1 + x
    else:
        return x


# 1,5,9,13,... => 1
# 3,7,11,15,... => 0 x % 4 == 2 x % 4 x 4 2 return 1 + x 1 + x 1 x return x x x x A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B x = calc(A - 1) x calc(A - 1) calc A - 1 A 1 y = calc(B) y calc(B) calc B print(x ^ y) print x ^ y x y A, B = map(int, input().split()) map(int, input().split()) A x = calc(A - 1) calc(A - 1) x B = map(int, input().split()) map(int, input().split()) B y = calc(B) calc(B) y def calc(x):
    if x % 4 == 1:
        return 1
    if x % 4 == 3:
        return 0
    
    if x % 4 == 2:
        return 1 + x
    else:
        return x


# 1,5,9,13,... => 1
# 3,7,11,15,... => 0 def calc(x):
    if x % 4 == 1:
        return 1
    if x % 4 == 3:
        return 0
    
    if x % 4 == 2:
        return 1 + x
    else:
        return x


# 1,5,9,13,... => 1
# 3,7,11,15,... => 0 calc
def calc(x):
    if x % 4 == 1:
        return 1
    if x % 4 == 3:
        return 0
    
    if x % 4 == 2:
        return 1 + x
    else:
        return x


# 1,5,9,13,... => 1
# 3,7,11,15,... => 0
A, B = map(int, input().split())
x = calc(A - 1)
y = calc(B)
print(x ^ y)
