l, r = gets.split.map &:to_i
if r - l >= 2019
    ans = 0
else
    ans = 1000000
    for i in l..r
        for j in (i+1)..r
            k = (i * j) %2019
            ans = k if ans > k
        end
    end
end
p ans