l,r = gets.split.map(&:to_i)
min = 2019
(l...r).each do |i|
    (i + 1..r).each do |j|
      mod = (i*j) % 2019
      if mod == 0
        p 0
        exit
      elsif mod < min
        min = mod
      end
    end
end
puts min
