l, r = gets.chop.split.map(&:to_i)

min_mod = 99999999
for i in l..r-1
  for j in l+1..r
    if i >= j
      next
    end
    if min_mod > i*j % 2019
      min_mod = i*j % 2019
    end
  end
end

puts min_mod