a,b = map(int,input().split())

p=a-1
if (a-1)%4==0:
  p=a-1
elif (a-1)%4==1:
  p=1
elif (a-1)%4==2:
  p=(a-1)^1
else:
  p=0
  
if b%4==0:
  b=b
elif b%4==1:
  b=1
elif b%4==2:
  b=b^1
else:
  b=0
print(p^b) a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b p=a-1 p a-1 a 1 if (a-1)%4==0:
  p=a-1
elif (a-1)%4==1:
  p=1
elif (a-1)%4==2:
  p=(a-1)^1
else:
  p=0
   (a-1)%4==0 (a-1)%4 a-1 a 1 4 0 p=a-1 p a-1 a 1 elif (a-1)%4==1:
  p=1 (a-1)%4==1 (a-1)%4 a-1 a 1 4 1 p=1 p 1 elif (a-1)%4==2:
  p=(a-1)^1 (a-1)%4==2 (a-1)%4 a-1 a 1 4 2 p=(a-1)^1 p (a-1)^1 a-1 a 1 1 p=0 p 0 if b%4==0:
  b=b
elif b%4==1:
  b=1
elif b%4==2:
  b=b^1
else:
  b=0 b%4==0 b%4 b 4 0 b=b b b elif b%4==1:
  b=1 b%4==1 b%4 b 4 1 b=1 b 1 elif b%4==2:
  b=b^1 b%4==2 b%4 b 4 2 b=b^1 b b^1 b 1 b=0 b 0 print(p^b) print p^b p b b=0 0 b b=1 1 b p=a-1 a-1 p b = map(int,input().split()) map(int,input().split()) b p=1 1 p a,b = map(int,input().split()) map(int,input().split()) a p=a-1 a-1 p b=b^1 b^1 b b=b b b p=0 0 p p=(a-1)^1 (a-1)^1 p
a,b = map(int,input().split())

p=a-1
if (a-1)%4==0:
  p=a-1
elif (a-1)%4==1:
  p=1
elif (a-1)%4==2:
  p=(a-1)^1
else:
  p=0
  
if b%4==0:
  b=b
elif b%4==1:
  b=1
elif b%4==2:
  b=b^1
else:
  b=0
print(p^b)