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 (toInteger . unsafeSignedDecimal) . T.words <$> T.getLine :: IO [Integer]
  as <- map (toInteger . unsafeSignedDecimal) . T.words <$> T.getLine :: IO [Integer]
  let
    c = foldl lcm 1 as :: Integer
    sum' :: [Int] -> Int
    sum' = foldl step 0
      where
        modulus' = fromInteger modulus :: Int
        step x y = (x + y) `mod` modulus'
  print . sum' . map (fromInteger . (`mod` modulus) . (c `div`)) $ as

modulus = 10 ^ 9 + 7 :: Integer

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