L, R = gets.chomp.split.map(&:to_i)
min = 2020
(L..R).each do |i|
	((i+1)..R).each do |j|
      imod = i % 2019
      jmod = j % 2019
      tmp = imod * jmod
      min = tmp if min > tmp
	end
end

puts min