def xor_0_n(n):
    if n % 2 == 1 and (n//2) % 2 == 1:
        n = 0
    elif n % 2 == 1 and (n//2) % 2 == 0:
        n = 1
    elif n % 2 == 0 and (n//2) % 2 == 1:
        n ^= 1
    return n
  
a, b = map(int,input().split())

print(xor_0_n(a-1)^xor_0_n(b)) def xor_0_n(n):
    if n % 2 == 1 and (n//2) % 2 == 1:
        n = 0
    elif n % 2 == 1 and (n//2) % 2 == 0:
        n = 1
    elif n % 2 == 0 and (n//2) % 2 == 1:
        n ^= 1
    return n
   xor_0_n if n % 2 == 1 and (n//2) % 2 == 1:
        n = 0
    elif n % 2 == 1 and (n//2) % 2 == 0:
        n = 1
    elif n % 2 == 0 and (n//2) % 2 == 1:
        n ^= 1
     n % 2 == 1 and (n//2) % 2 == 1 n % 2 == 1 n % 2 n 2 1 (n//2) % 2 == 1 (n//2) % 2 n//2 n 2 2 1 n = 0 n 0 elif n % 2 == 1 and (n//2) % 2 == 0:
        n = 1
     n % 2 == 1 and (n//2) % 2 == 0 n % 2 == 1 n % 2 n 2 1 (n//2) % 2 == 0 (n//2) % 2 n//2 n 2 2 0 n = 1 n 1 elif n % 2 == 0 and (n//2) % 2 == 1:
        n ^= 1
     n % 2 == 0 and (n//2) % 2 == 1 n % 2 == 0 n % 2 n 2 0 (n//2) % 2 == 1 (n//2) % 2 n//2 n 2 2 1 n ^= 1 n 1 return n n n n a, b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b print(xor_0_n(a-1)^xor_0_n(b)) print xor_0_n(a-1)^xor_0_n(b) xor_0_n(a-1) xor_0_n a-1 a 1 xor_0_n(b) xor_0_n b def xor_0_n(n):
    if n % 2 == 1 and (n//2) % 2 == 1:
        n = 0
    elif n % 2 == 1 and (n//2) % 2 == 0:
        n = 1
    elif n % 2 == 0 and (n//2) % 2 == 1:
        n ^= 1
    return n
   def xor_0_n(n):
    if n % 2 == 1 and (n//2) % 2 == 1:
        n = 0
    elif n % 2 == 1 and (n//2) % 2 == 0:
        n = 1
    elif n % 2 == 0 and (n//2) % 2 == 1:
        n ^= 1
    return n
   xor_0_n a, b = map(int,input().split()) map(int,input().split()) a b = map(int,input().split()) map(int,input().split()) b
def xor_0_n(n):
    if n % 2 == 1 and (n//2) % 2 == 1:
        n = 0
    elif n % 2 == 1 and (n//2) % 2 == 0:
        n = 1
    elif n % 2 == 0 and (n//2) % 2 == 1:
        n ^= 1
    return n
  
a, b = map(int,input().split())

print(xor_0_n(a-1)^xor_0_n(b))
