L, R = gets.split.map(&:to_i)

if R - L >= 2018
  puts 0
else
  ans = 2019

  (L..R-1).each do |i|
    (i+1..R).each do |j|
      # p "i:#{i} j:#{j}"
      t = i*j % 2019
      if ans > t
        ans = t
      end
    end
  end

  p ans
end
