left, right = gets.chomp.split.map(&:to_i)

if right - left >= 2019 then
    puts 0
else
    res = 114514
    (left..right).each do |i|
        tmp = i % 2019
        res = tmp if tmp < res
    end
    puts res * (res+1)
end