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

min = ''
count = 0
(L..R).each do |n|
  (L..R).each do |k|
    next if n == k

    t = (n * k) % 2019
    min = t if t < min.to_i || count.zero?
    count += 1
    break if min.zero?
    break if R - 1 == n
  end
end
print min
