import Control.Monad
import Data.List

getNums = getLine >>= return . map read . words

solve n ps js = f (n*m) n m (reverse $ sort js)
 where
  m = sum ps
  f a _ _ [] = a
  f a n m (j:js)
   | a > a' = a
   | otherwise = f a' n' m' js
   where 
    n' = n-1
    m' = m+j
    a' = n'*m'

main = do
 (n:_) <- getNums
 when (n /= 0) $ do
  ps <- getNums
  js <- getNums
  print $ solve n ps js
  main