l,r = gets.chomp.split(" ").map(&:to_i)
lmod = l%2019
rmod = r%2019

if r-l >= 2019 || lmod >= rmod
    puts 0
else
    min = l*(l+1)
    min %= 2019
    for i in l..r-1 do
        for j in i+1..r
            pro = i*j
            pro %= 2019
            if pro < min 
                min = pro
            end
        end
    end
    puts min
end