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

min = 2019
L.step(R) do |i|
  i.step(R) do |j|
    next if i == j
    n = i * j % 2019
    min = n if n < min
    break if min == 0
  end
  break if min == 0
end
puts min