input = gets
a = input.split(" ")[0].to_i
b = input.split(" ")[1].to_i
c=  a-1
if c%2 == 0 then
   if c%4 == 0 then
    kari = c
   else kari = 1 ^ c
   end
elsif c%4 == 1 then
    kari = 1
else
    kari = 0
end

if b%2 == 0 then
    if b%4 == 0 then
     b2 = b
    else b2 = 1 ^ b
    end
 elsif b%4 == 1 then
     b2 = 1
 else
     b2 = 0
 end

 print kari ^ b2