a,b = gets.split.map {|x| x.to_i}

def f(v)
  if v % 4 == 0
    return v
  elsif v % 4 == 1
    return 1
  elsif v % 4 == 2
    return 1 + v
  else
    return 0
  end
end

if a == 0
  puts f(b)
else
  puts f(b) ^ f(a-1)
end
