Buggy python submission (verdict: Runtime Error):
import numpy


MOD = 10 ** 9 + 7
N = int(input())
A = list(map(int, input().split()))

lcm = 1
for a in A:
    lcm = numpy.lcm(lcm, a)
lcm %= MOD

ans = 0
for a in A:
    ans += lcm * pow(a, MOD - 2, MOD) % MOD
    ans %= MOD

print(ans)


Fixed submission:
from fractions import gcd

mod = 10 ** 9 + 7

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

lcm = 1
for s in A:
    lcm = s * lcm // gcd(lcm, s)

ans = lcm * sum([pow(s, mod - 2, mod) for s in A]) % mod

print(int(ans % mod))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd

mod = 10 ** 9 + 7

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

lcm = 1
for s in A:
    lcm = s * lcm // gcd(lcm, s)

# ans = lcm * sum([pow(s, mod - 2, mod) for s in A]) % mod
ans = sum([lcm//s % mod for s in A]) % mod

print(int(ans % mod))


Fixed submission:
from fractions import gcd

mod = 10 ** 9 + 7

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

lcm = 1
for s in A:
    lcm = s * lcm // gcd(lcm, s)

ans = lcm * sum([pow(s, mod - 2, mod) for s in A]) % mod

print(int(ans % mod))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

from fractions import gcd


def lcm(a, b):
    return a * b / gcd(a, b)


MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

l = 1
for a in A:
    l = lcm(l, a)

l %= MOD

ans = 0
for a in A:
    ans += l * pow(a, MOD-2, MOD) % MOD
    ans %= MOD

print(int(ans))


Fixed submission:
from fractions import gcd

mod = 10 ** 9 + 7

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

lcm = 1
for s in A:
    lcm = s * lcm // gcd(lcm, s)

ans = lcm * sum([pow(s, mod - 2, mod) for s in A]) % mod

print(int(ans % mod))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
import sys
input = sys.stdin.readline


def lcm(a, b):
    return a * b / gcd(a, b)


MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

l = 1
for a in A:
    l = lcm(l, a)

l %= MOD

ans = 0
for a in A:
    ans += l * pow(a, MOD-2, MOD)
    ans %= MOD

print(int(ans))


Fixed submission:
from fractions import gcd

mod = 10 ** 9 + 7

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

lcm = 1
for s in A:
    lcm = s * lcm // gcd(lcm, s)

ans = lcm * sum([pow(s, mod - 2, mod) for s in A]) % mod

print(int(ans % mod))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd


def lcm(a, b):
    return a * b / gcd(a, b)


MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

l = 1
for a in A:
    l = lcm(l, a)

l %= MOD

ans = 0
for a in A:
    ans += l * pow(a, MOD-2, MOD)
    ans %= MOD

print(int(ans))


Fixed submission:
from fractions import gcd

mod = 10 ** 9 + 7

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

lcm = 1
for s in A:
    lcm = s * lcm // gcd(lcm, s)

ans = lcm * sum([pow(s, mod - 2, mod) for s in A]) % mod

print(int(ans % mod))

Buggy python submission (verdict: Runtime Error):
from fractions import gcd


def lcm(a, b):
    return a * b / gcd(a, b)
 

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

l = 1
for a in A:
    l = lcm(l, a)

l %= MOD

ans = 0
for a in A:
    ans += l * pow(a, MOD-2, MOD)
    ans %= MOD

print(int(ans))


Fixed submission:
from fractions import gcd

mod = 10 ** 9 + 7

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

lcm = 1
for s in A:
    lcm = s * lcm // gcd(lcm, s)

ans = lcm * sum([pow(s, mod - 2, mod) for s in A]) % mod

print(int(ans % mod))

Buggy python submission (verdict: Runtime Error):
MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

l = 1
for a in A:
    l = lcm(l, a)

l %= MOD

ans = 0
for a in A:
    ans += l * pow(a, MOD-2, MOD)
    ans %= MOD

print(int(ans))


Fixed submission:
from fractions import gcd

mod = 10 ** 9 + 7

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

lcm = 1
for s in A:
    lcm = s * lcm // gcd(lcm, s)

ans = lcm * sum([pow(s, mod - 2, mod) for s in A]) % mod

print(int(ans % mod))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict


def mod_inv(a, m):
    return pow(a, m-2, m)


MOD = 10**9+7
MX = 10**6+5
N = int(input())
A = list(map(int, input().split()))


P = defaultdict(int)

for a in set(A):
    e = defaultdict(int)
    rest = a
    for i in range(2, a + 1):
        while rest % i == 0:
            e[i] += 1
            rest //= i
    for k, v in e.items():
        P[k] = max(P[k], v)

lcm = 1
for k, v in P.items():
    lcm *= k ** v
    lcm %= MOD

ans = 0
for a in A:
    ans += lcm * mod_inv(a, MOD)
    ans %= MOD

print(int(ans))


Fixed submission:
from fractions import gcd

mod = 10 ** 9 + 7

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

lcm = 1
for s in A:
    lcm = s * lcm // gcd(lcm, s)

ans = lcm * sum([pow(s, mod - 2, mod) for s in A]) % mod

print(int(ans % mod))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd


def lcm(a, b):
    return a * b / gcd(a, b)


MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

B = sorted(set(A))

l = 1
for b in B:
    if l % b == 0:
        continue
    l = lcm(l, b)

ans = 0
for a in A:
    ans += l // a
    ans %= MOD

print(int(ans))


Fixed submission:
from fractions import gcd

mod = 10 ** 9 + 7

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

lcm = 1
for s in A:
    lcm = s * lcm // gcd(lcm, s)

ans = lcm * sum([pow(s, mod - 2, mod) for s in A]) % mod

print(int(ans % mod))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd


def lcm(a, b):
    return a * b / gcd(a, b)


MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

l = 1
for a in A:
    l = lcm(l, a)

ans = 0
for a in A:
    ans += l // a
    ans %= MOD

print(int(ans))



Fixed submission:
from fractions import gcd

mod = 10 ** 9 + 7

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

lcm = 1
for s in A:
    lcm = s * lcm // gcd(lcm, s)

ans = lcm * sum([pow(s, mod - 2, mod) for s in A]) % mod

print(int(ans % mod))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd


def lcm(a, b):
    return a * b / gcd(a, b)


MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

l = 1
for a in A:
    l = lcm(l, a)

B = [l // a for a in A]

print(int(sum(B)) % MOD)


Fixed submission:
from fractions import gcd

mod = 10 ** 9 + 7

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

lcm = 1
for s in A:
    lcm = s * lcm // gcd(lcm, s)

ans = lcm * sum([pow(s, mod - 2, mod) for s in A]) % mod

print(int(ans % mod))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd


def lcm(a, b):
    return a * b / gcd(a, b)


MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

l = 1
for a in A:
    l = lcm(l, a)

B = [l // a for a in A]

print(int(sum(B)) % MOD)


Fixed submission:
from fractions import gcd

mod = 10 ** 9 + 7

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

lcm = 1
for s in A:
    lcm = s * lcm // gcd(lcm, s)

ans = lcm * sum([pow(s, mod - 2, mod) for s in A]) % mod

print(int(ans % mod))