L,R = gets.split.map(&:to_i)
Z = 2019
if R-L < 2019 then
    min = Z**2
    [*L..R].combination(2).to_a.each_with_index do |z, index|
        a = (z[0]*z[1])%Z
        min = a if a < min
        break if min == 0
    end
    puts min
else
    puts "0"
end