main::IO()
main = do
  n <- getLine
  ds <- map read . words <$> getLine
  putStrLn $ show $ sumTakoyaki ds

sumTakoyaki :: [Int] -> Int
sumTakoyaki [] = 0
sumTakoyaki (d:ds) = s + (sumTakoyaki ds)
                      where s = foldl (flip $ (+) . (d*)) 0 ds
