{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE FlexibleContexts    #-}
{-# LANGUAGE FlexibleInstances   #-}
{-# LANGUAGE OverloadedStrings #-}

import Control.Applicative
import Control.Monad.State
import qualified Numeric                       as Nu
import qualified Control.Monad                 as CM
import qualified Data.List                     as L
import qualified Control.Monad.ST              as ST
import qualified Data.ByteString.Char8         as BS
import qualified Data.Array                    as A
import qualified Data.Array.IO                 as AI
import qualified Data.Char                     as Ch
import qualified Data.Text                     as T
import qualified Data.IORef                    as IO
import qualified Data.Text.IO                  as T
import qualified Data.Array.ST                 as AST
import qualified Data.ByteString.Builder       as BB
import qualified Data.Set                      as Set
import qualified Data.Map.Strict               as Map
import qualified Data.Sequence                 as Seq
import qualified Data.Maybe                    as May
import Data.Graph

import Prelude hiding (print)


main = do
    n <- cin @Int
    print$sum$solve n


solve :: Int -> [Int]
solve n =
    let f n = if n == 1
              then []
              else
                let d = L.head $ L.filter (\x -> n `mod` x == 0) [2..n]
                in d : f (n `div` d)
                in f n

type Moji= BS.ByteString



buildUndirected :: [(Int,Int)] -> [(Int,Int)]
buildUndirected x= Set.toList$Set.fromList $ concatMap (\ (a, b) -> [(a, b), (b, a)]) x



print :: Show a => a -> IO ()
print x=BS.putStrLn $ BS.pack $ show x

class Sanao a where
  sanao :: Moji -> a
  {-# MINIMAL sanao #-}

instance Sanao Moji  where
  sanao= id

instance Sanao Int where
    sanao x= case BS.readInt x of
                Nothing -> error "ここはInt"
                Just (a,_) -> a

instance Sanao Double where
    sanao x= case BS.readInt x of
                Nothing -> error "ここはDouble"
                Just (a,_) -> realToFrac a

instance Sanao [Moji] where
    sanao=BS.words

instance (Sanao a)=>Sanao [a] where
    sanao= map sanao.BS.words

instance Sanao(Int,Int) where
    sanao= (\[a, b]->(a, b)) . map sanao . BS.words

instance Sanao(Int, Int, Int) where
    sanao= (\[a, b, c]->(a, b, c)) . map sanao . BS.words

instance Sanao(Int, Int, Int, Int) where
    sanao= (\[a, b, c, d]->(a, b, c, d)) . map sanao . BS.words

instance Sanao(Double,Double) where
    sanao= (\[a, b]->(a, b)) . map sanao . BS.words

instance Sanao(Double,Double, Double) where
    sanao= (\[a, b, c]->(a, b, c)) . map sanao . BS.words

instance Sanao(Double,Double, Double, Double) where
    sanao= (\[a, b, c, d]->(a, b, c, d)) . map sanao . BS.words

instance Sanao(Moji,Int) where
    sanao= (\[a, b]->(a,sanao b)) . BS.words

instance Sanao(Moji,Int, Int) where
    sanao= (\[a, b, c]->(a,sanao b, sanao c)) . BS.words

instance Sanao(Int,Moji) where
    sanao= (\[a, b]->(sanao a,b)) . BS.words

instance Sanao(Moji,Double) where
    sanao= (\[a, b]->(a,sanao b)) . BS.words

cin::Sanao a=>IO a
cin=sanao<$>BS.getLine

instance Sanao(Double,Moji) where
    sanao= (\[a, b]->(sanao a,b)) . BS.words