{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}

import GHC.TypeLits
import Data.Int
import Data.Proxy
import qualified Data.Map.Lazy as Map
import Control.Monad
import Control.Monad.State
import Data.List

import Data.Maybe
import qualified Data.ByteString.Char8 as BS

data Mint (m :: Nat) = Mint {getMintValue :: Integer} deriving (Eq, Show)

getMintMod :: forall p. KnownNat p => Mint p -> Integer
getMintMod = natVal

makeMint :: forall p. KnownNat p => Integer -> Mint p
makeMint a = let r = Mint $ fromInteger $ a `mod` (getMintMod r) in r

instance KnownNat p => Num (Mint p) where
  (Mint a) + (Mint b) = makeMint $ a + b
  (Mint a) - (Mint b) = makeMint $ a - b
  (Mint a) * (Mint b) = makeMint $ a * b
  negate (Mint a) = makeMint $ negate a
  abs = id
  signum (Mint a) = if a == 0 then 0 else 1
  fromInteger = makeMint

invMint :: forall p. KnownNat p => Mint p -> Mint p
invMint m = let p = getMintMod m in m ^ (p - 2)



factorize :: Integral a => a -> [(a, Int)]
factorize n = let (m, xs) = divideAll n 2 in if m /= 1 then reverse $ (m, 1) : (reverse xs) else xs
  where
    divide n p
      | n `mod` p == 0 = let (m, c) = divide (n `div` p) p in (m, c+1)
      | otherwise = (n, 0)

    divideAll n p
      | p * p > n = (n, [])
      | otherwise = 
          let
            x @ (m, c) = divide n p
          in
            if c == 0 then
              divideAll m (p+1)
            else
              let (q, xs) = divideAll m (p+1)
              in (q, (p, c) : xs)



type M = Mint 1000000007

getInts = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine


main :: IO ()
main = do
  n <- readLn :: IO Int
  a <- getInts :: IO [Int]

  let l = product .
          map (\xs @ (x:_) -> (fromIntegral (fst x) :: M) ^ (maximum $ map snd xs)) .
          groupBy (\(x, _) (y, _) -> x == y) .
          sort . concat $ (map factorize a)

  let ans = sum $ map ((l *) . invMint . (fromIntegral :: Int -> M)) a
  print $ getMintValue ans
