l, r = STDIN.gets.chomp.split(' ').map(&:to_i)
            
result = 3000
            
if r - l > 2019 - 1 then
  result = 0
else        
  for i in l..(r-1)
    for j in (l+1)..r
      if (((i % 2019) * (j % 2019)) % 2019) < result then
        result = (((i % 2019) * (j % 2019)) % 2019)
      end
    end
  end
end

puts result 