import qualified Data.ByteString.Char8 as BS

uo=1000000007
h l k |k==1   =mod l uo
      |even k =h(mod(l*l)uo)(quot k 2)
      |odd k  =mod((h l (k-1))*l)uo

main=do
 n<-readLn;a<-map (read.BS.unpack).BS.words<$>BS.getLine
 print(f n a (g n a 1) 0)
  where g 0 _ l = mod l uo
        g n (k:a) l = g (n-1) a (lcm k l)
        f 0 _ _ i = i
        f n (k:a) l i = f (n-1) a l (mod(i+l*(h k (uo-2)))uo)