l,r = gets.split(" ").map{|i|i.to_i}
if  r-l > 2018 then
	puts 0
else
	min = 2018
		for p in l..r-1 do
			for q in p+1..r do
				if (p*q)%2019 < min then
					min = (p*q)%2019
				end
			end
		end
        puts min
end