import Control.Applicative import Control.Monad import System.IO main :: IO () main = do n_temp <- getLine let n = read n_temp :: Int a_temp <- getLine let a = map read $ words a_temp :: [Int] print (sum (map factSum a)) factors n = head [x | x <- [2..n], mod n x == 0] bigFactor n = quot n (factors n) factSum n | n == 1 = 1 | otherwise = n + factSum (bigFactor n) getMultipleLines :: Int -> IO [String] getMultipleLines n | n <= 0 = return [] | otherwise = do x <- getLine xs <- getMultipleLines (n-1) let ret = (x:xs) return ret