import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Vector.Unboxed as V

main :: IO ()
main = do
  (n : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  as <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  let
    prepare :: [Int] -> (Integer, Int)
    prepare = foldl step (1, 0)
      where
        step :: (Integer, Int) -> Int -> (Integer, Int)
        step (c, m) a = c `seq` m `seq` (lcm c (toInteger a), (m + inv a) `mod` modulus)
  print . (`mod` modulus) . ((*) <$> fromInteger . (`mod` toInteger modulus) . fst <*> snd) . prepare $ as

inv :: Int -> Int
inv = (invs V.!)
  where
    inv' 1 = 1
    invs :: V.Vector Int
    invs = V.constructN (10 ^ 6 + 1) rec
      where
        rec v = case l of
                  0 -> 0
                  1 -> 1
                  _ -> let (q, r) = modulus `divMod` l in (modulus - (v V.! r) * q) `mod` modulus
          where
            l = V.length v

modulus = 10 ^ 9 + 7 :: Int

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n
