L,R = gets.split.map(&:to_i)
Z = 2019
left = L/Z
right = R/Z
if left == right && L%Z!=0 then
    min = L % Z
    max = R % Z
    s = 10**9
    t = []
    [*min..max].combination(2).to_a.each_with_index do |z, index|
        if z[0]*z[1] < s then
            s = z[0]*z[1]
            t = z
        end
    end
    puts s
else
    puts "0"
end