l,r = gets.split(' ').map(&:to_i)
min = 1000000
if l/2019 != r/2019
  puts 0
else
   (l..r-1).each do |i|
     (i+1..r).each do |j|
      ans = (i * j) % 2019
      if ans < min
        min = ans
      end
    end
  end
    puts min
end
