l, r = gets.strip.split.map(&:to_i)
y = 2019

min = 10**9

(l..l+2018).each do |i|
  (i+1..l+2018).each do |j|
    if i < r  && j <= r
      m = (i * j) % y
      min = m if m < min
      if m == 0
        puts "0"
        exit
      end
    end
  end
end
puts min