l,r = gets.split.map(&:to_i)
result = []

2019.times do |i|
  if (l + i) > r
    break
  end
  result << (l+i) % 2019
end
ans = 2019
result.each do |i|
  result.each do |j|
    if i == j
      next
    end
    if (i * j)%2019 < ans
      ans = (i * j) % 2019
    end
  end
end

puts ans
