import Control.Applicative

main :: IO ()
main = do
    _ <- getLine
    ns <- map read . words <$> getLine
    putStrLn $ show (solve ns)

solve :: [Int] -> Int
solve ns = sum (concat (comb2 ns)) 
            
comb2 :: [Int] -> [[Int]]
comb2 []     = []
comb2 (n:ns) = map (*n) ns : comb2 ns