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

target = []
tmp = L
for i in 1..2019
    break if tmp > R 
    target.push(tmp)
    tmp += 1
end

ans = 2020
target.each_with_index{|x,xi|
    target.each_with_index{|y,yi|
        next if xi == yi
        # puts ("x=#{x} xi=#{xi} y=#{y} yi=#{yi}")
        ans = [(x*y)%2019, ans].min
    }
}

puts ans
