program atcoder
implicit none
integer(16) :: a(2),f(2),i

read(*,*) a(1:2)

a(1) = a(1)-1
do i = 1,2
	if (mod(a(i),4) == 0) then
    	f(i) = a(i)
    else if (mod(a(i),4) == 1) then
    	f(i) = 1
    else if (mod(a(i),4) == 2) then
    	f(i) = a(i) + 1
    else if (mod(a(i),4) == 3) then
    	f(i) = 0
    else if (a(i) == -1) then
    	f(i) = 0
    end if
end do

write(*,'(i0)') xor(f(1),f(2))

contains

end program atcoder