### main

while true
  n = gets.strip.to_i
  break if n == 0

  pipes = gets.strip.split(' ').map{|s| s.to_i}
  joints = gets.strip.split(' ').map{|s| s.to_i}
  #p $pipes
  #p $joints

  sum = pipes.inject(0){|s, pi| s + pi}
  num = n

  joints.sort!{|a, b| b <=> a}

  while ! joints.empty?
    ji = joints.shift

    if sum < ji * (num - 1)
      sum += ji
      num -= 1
    else
      break
    end
  end

  puts sum * num
end