
import qualified Data.ByteString.Char8 as BS

main = do
    ni <- BS.getLine 
    let n = read $ BS.unpack ni :: Int
    cal <- map (read . BS.unpack) . BS.words <$> BS.getLine :: IO [Int]
    putStrLn $ show $ multi cal

multi :: [Int] -> Int
multi (x:[]) = 0
multi (x:xs) = rest + (multi xs)
    where rest = sum $ map (*x) xs