L, R = gets.split(' ').map{|n| n.to_i}
if R - L >= 2018
  puts 0
  exit
end

min = 2019
(L..(R - 1)).each do |i|
  ((L + 1)..R).each do |j|
    if i != j
      n = i * j % 2019
      min = n if n < min
      if n == 0
        puts 0
        exit
      end
    end
  end
end
puts min