lr=gets.chomp.split(" ").map(&:to_i)
if((lr[0]<=2019*(lr[1]/2019) and lr[1]>=2019*(lr[1]/2019)))
	p 0
elsif((2019-lr[0]).abs<(2019-lr[1]).abs)
	i=lr[0]
	j=lr[0]+1
	p i*j%2019
else
	i=lr[1]
	j=lr[1]-1
	p i*j%2019
end