str = gets.split
L,R = str[0].to_i, str[1].to_i

if R-L >= 2018
    puts 0
    exit
elsif L > R
    puts 0
    exit
elsif L == 0
    puts 0
    exit
end

answer = 2019
for x in L...R do
    for y in x+1..R do
        if (x*y)%2019 < answer
            answer = (x*y)%2019
        end
    end
end

puts answer