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

def calc_xor(n): #nは0以上
  if n%2==0:
    p=n//2
    if p%2==0:
      q=0
    else:
      q=1
    return q^n
  else:
    p=(n+1)//2
    if p%2==0:
      q=0
    else:
      q=1
    return q

#print(calc_xor(A-1))
#print(calc_xor(B))
print(calc_xor(A-1)^calc_xor(B)) A,B=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B def calc_xor(n): #nは0以上
  if n%2==0:
    p=n//2
    if p%2==0:
      q=0
    else:
      q=1
    return q^n
  else:
    p=(n+1)//2
    if p%2==0:
      q=0
    else:
      q=1
    return q

#print(calc_xor(A-1))
#print(calc_xor(B)) calc_xor if n%2==0:
    p=n//2
    if p%2==0:
      q=0
    else:
      q=1
    return q^n
  else:
    p=(n+1)//2
    if p%2==0:
      q=0
    else:
      q=1
    return q

#print(calc_xor(A-1))
#print(calc_xor(B)) n%2==0 n%2 n 2 0 p=n//2 p n//2 n 2 if p%2==0:
      q=0
    else:
      q=1
     p%2==0 p%2 p 2 0 q=0 q 0 q=1 q 1 return q^n q^n q n p=(n+1)//2 p (n+1)//2 n+1 n 1 2 if p%2==0:
      q=0
    else:
      q=1
     p%2==0 p%2 p 2 0 q=0 q 0 q=1 q 1 return q q n n print(calc_xor(A-1)^calc_xor(B)) print calc_xor(A-1)^calc_xor(B) calc_xor(A-1) calc_xor A-1 A 1 calc_xor(B) calc_xor B B=map(int,input().split()) map(int,input().split()) B def calc_xor(n): #nは0以上
  if n%2==0:
    p=n//2
    if p%2==0:
      q=0
    else:
      q=1
    return q^n
  else:
    p=(n+1)//2
    if p%2==0:
      q=0
    else:
      q=1
    return q

#print(calc_xor(A-1))
#print(calc_xor(B)) def calc_xor(n): #nは0以上
  if n%2==0:
    p=n//2
    if p%2==0:
      q=0
    else:
      q=1
    return q^n
  else:
    p=(n+1)//2
    if p%2==0:
      q=0
    else:
      q=1
    return q

#print(calc_xor(A-1))
#print(calc_xor(B)) calc_xor A,B=map(int,input().split()) map(int,input().split()) A
A,B=map(int,input().split())

def calc_xor(n): #nは0以上
  if n%2==0:
    p=n//2
    if p%2==0:
      q=0
    else:
      q=1
    return q^n
  else:
    p=(n+1)//2
    if p%2==0:
      q=0
    else:
      q=1
    return q

#print(calc_xor(A-1))
#print(calc_xor(B))
print(calc_xor(A-1)^calc_xor(B))
