from collections import defaultdict

N=int(eval(input()))

A=list(map(int,input().split()))



MOD=10**9+7



inv=[1]*(10**6+1)

for i in range(2,10**6+1):

    inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD



LCM=defaultdict(int)

def f(n):

    tmp=0

    p=2

    while n%p==0:

        tmp+=1

        n//=p

    LCM[p]=max(LCM[p],tmp)

    p=3

    while p*p<=n:

        tmp=0

        while n%p==0:

            tmp+=1

            n//=p

        LCM[p]=max(LCM[p],tmp)

        p+=2

    if n>1:

        LCM[n]=max(LCM[n],1)



for a in A: f(a)



l=1

for p,n in list(LCM.items()):

    l=l*pow(p,n,MOD)%MOD



ans=0

for a in A:

    ans+=l*inv[a]%MOD



print((ans%MOD))
from collections import defaultdict

N=int(eval(input()))

A=list(map(int,input().split()))



MOD=10**9+7



primes=[]

is_prime=[True]*(10**3)

for i in range(2,10**3):

    if not is_prime[i]: continue

    primes.append(i)

    for j in range(2*i,10**3,i):

        is_prime[j]=False



LCM=defaultdict(int)

for n in A:

    for p in primes:

        tmp=0

        while n%p==0:

            tmp+=1

            n//=p

        LCM[p]=max(LCM[p],tmp)

    if n!=1:

        LCM[n]=max(LCM[n],1)

l=1

for p,n in list(LCM.items()):

    l=l*pow(p,n,MOD)%MOD



ans=0

for a in A:

    ans+=l*pow(a,MOD-2,MOD)

    ans%=MOD



print(ans)
from collections import defaultdict

N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
inv = [1] * (10**6 + 1)
for i in range(2, 10**6 + 1):
    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
LCM = defaultdict(int)


def f(n):
    tmp = 0
    p = 2
    while n % p == 0:
        tmp += 1
        n //= p
    LCM[p] = max(LCM[p], tmp)
    p = 3
    while p * p <= n:
        tmp = 0
        while n % p == 0:
            tmp += 1
            n //= p
        LCM[p] = max(LCM[p], tmp)
        p += 2
    if n > 1:
        LCM[n] = max(LCM[n], 1)


for a in A:
    f(a)
l = 1
for p, n in list(LCM.items()):
    l = l * pow(p, n, MOD) % MOD
ans = 0
for a in A:
    ans += l * inv[a] % MOD
print((ans % MOD))

from collections import defaultdict

N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
primes = []
is_prime = [True] * (10**3)
for i in range(2, 10**3):
    if not is_prime[i]:
        continue
    primes.append(i)
    for j in range(2 * i, 10**3, i):
        is_prime[j] = False
LCM = defaultdict(int)
for n in A:
    for p in primes:
        tmp = 0
        while n % p == 0:
            tmp += 1
            n //= p
        LCM[p] = max(LCM[p], tmp)
    if n != 1:
        LCM[n] = max(LCM[n], 1)
l = 1
for p, n in list(LCM.items()):
    l = l * pow(p, n, MOD) % MOD
ans = 0
for a in A:
    ans += l * pow(a, MOD - 2, MOD)
    ans %= MOD
print(ans)

-inv = [1] * (10**6 + 1) -for i in range(2, 10**6 + 1): -    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD +primes = [] +is_prime = [True] * (10**3) +for i in range(2, 10**3): +    if not is_prime[i]: +        continue +    primes.append(i) +    for j in range(2 * i, 10**3, i): +        is_prime[j] = False - - -def f(n): -    tmp = 0 -    p = 2 -    while n % p == 0: -        tmp += 1 -        n //= p -    LCM[p] = max(LCM[p], tmp) -    p = 3 -    while p * p <= n: +for n in A: +    for p in primes: -        p += 2 -    if n > 1: +    if n != 1: - - -for a in A: -    f(a) -    ans += l * inv[a] % MOD -print((ans % MOD)) +    ans += l * pow(a, MOD - 2, MOD) +    ans %= MOD +print(ans)