L, R = gets.strip.split.map(&:to_i)

res = 2019
 
for i in L..R-1
  for j in i+1..R
    if res > i*j % 2019
      res = i*j % 2019
    end
    if res == 0
      puts 0
      exit
    end
  end
end

puts res
