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
    for j in (l+1)..r
      if (i * j) % 2019 < result then
        result = (i * j) % 2019
      end
    end
  end
end

puts result 