l, r = gets.chomp.split(" ").map(&:to_i)

min = 10 ** 6
for i in l..(r - 1)
    for j in (i + 1)..r
        min = (i * j) % 2019 if min > (i * j) % 2019
        break if min == 0
    end
    break if min == 0
end
puts min
