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

if R-L > 2019
    puts 0
else
    ans = 2020
    for i in L..R 
        for j in i+1..R 
            a = i % 2019
            b = j % 2019
            ans = [ans, (a*b)%2019].min
        end
    end
end

puts ans