l,r = gets.split(' ').map(&:to_i)

min = 2019
if l-r >= 2019
    puts 0
    exit
else
    (l..(r-1)).each do |i|
        ((i+1)..r).each do |j|
            result = (i*j).modulo(2019)
            min = result if result < min
            if min == 0
                puts 0
                exit
            end
        end
    end
end

puts min