main :: IO ()
main = do
    l1 <- getLine
    let n = read l1
    l2 <- getLine
    let d = map read $ words l2 :: [Int]

    print $ sum $ map (f (*) d) [0..n - 1]

f g l i = sum $ map (g (l !! i)) (drop (i + 1) l)