input = gets.split.map(&:to_i)
ans = 3000
if input[1] - input[0] > 2020 then
  print 0
else
  (input[1] - input[0]).times{|t|
    n = t + input[0]
    k = n + 1
  while k <= input[1] and (k-input[0]) <=2020 do
   if ans > (n*k)%2019 then
      ans = (n*k)%2019
    end
    k+=1
  end
  }
  print ans
end