import numpy as np

N = int(eval(input()))

A = np.array(input().split(), np.int64)

MOD = 10**9+7



U = 10**6 + 10

T = np.zeros(U, np.bool)

T[2] = 1

T[3::2] = 1



for p in range(3,U,2):

  if p*p>U:

    break

  if T[p]==1:

    T[p*p::p+p] = 0



pls = np.where(T==1)[0].tolist()

M = pls[:1000]



B = A.copy()

lcm = 1

for p in M:

  e = 0

  while np.any(A%p==0):

    A[A%p==0] //= p

    e += 1

  lcm *= p**e

  lcm %= MOD

for x in set(A.tolist()):

  lcm *= x

  lcm %= MOD

x = sum(pow(c, MOD-2, MOD) for c in B.tolist())

print((x*lcm%MOD))
import numpy as np

N = int(eval(input()))

A = np.array(input().split(), np.int64)

MOD = 10**9+7



U = 10**6 + 10

T = np.zeros(U, np.bool)

T[2] = 1

T[3::2] = 1



for p in range(3,U,2):

  if p*p>U:

    break

  if T[p]==1:

    T[p*p::p+p] = 0



M = np.where(T[:1000])[0].tolist()



B = A.copy()

lcm = 1

for p in M:

  e = 0

  while np.any(A%p==0):

    A[A%p==0] //= p

    e += 1

  lcm *= p**e

  lcm %= MOD

for x in set(A.tolist()):

  lcm *= x

  lcm %= MOD

x = sum(pow(c, MOD-2, MOD) for c in B.tolist())

print((x*lcm%MOD))
import numpy as np

N = int(eval(input()))
A = np.array(input().split(), np.int64)
MOD = 10**9 + 7
U = 10**6 + 10
T = np.zeros(U, np.bool)
T[2] = 1
T[3::2] = 1
for p in range(3, U, 2):
    if p * p > U:
        break
    if T[p] == 1:
        T[p * p :: p + p] = 0
pls = np.where(T == 1)[0].tolist()
M = pls[:1000]
B = A.copy()
lcm = 1
for p in M:
    e = 0
    while np.any(A % p == 0):
        A[A % p == 0] //= p
        e += 1
    lcm *= p**e
    lcm %= MOD
for x in set(A.tolist()):
    lcm *= x
    lcm %= MOD
x = sum(pow(c, MOD - 2, MOD) for c in B.tolist())
print((x * lcm % MOD))

import numpy as np

N = int(eval(input()))
A = np.array(input().split(), np.int64)
MOD = 10**9 + 7
U = 10**6 + 10
T = np.zeros(U, np.bool)
T[2] = 1
T[3::2] = 1
for p in range(3, U, 2):
    if p * p > U:
        break
    if T[p] == 1:
        T[p * p :: p + p] = 0
M = np.where(T[:1000])[0].tolist()
B = A.copy()
lcm = 1
for p in M:
    e = 0
    while np.any(A % p == 0):
        A[A % p == 0] //= p
        e += 1
    lcm *= p**e
    lcm %= MOD
for x in set(A.tolist()):
    lcm *= x
    lcm %= MOD
x = sum(pow(c, MOD - 2, MOD) for c in B.tolist())
print((x * lcm % MOD))

-pls = np.where(T == 1)[0].tolist() -M = pls[:1000] +M = np.where(T[:1000])[0].tolist()