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

MAXN = 10**6+10
facts = [-1,-1] + [0]*MAXN
p = 2
while p*p <= MAXN:
    if facts[p] == 0:
        for q in range(p*p,MAXN+1,p):
            if facts[q]==0:
                facts[q] = p
    p += 1

from collections import Counter
ctr = Counter()
for a in A:
    c = Counter()
    while facts[a] > 0:
        c[facts[a]] += 1
        a //= facts[a]
    c[a] += 1
    ctr |= c

ans = 0
for a in A:
    c = Counter()
    while facts[a] > 0:
        c[facts[a]] += 1
        a //= facts[a]
    c[a] += 1
    t = 1
    for k,v in (ctr - c).items():
        t *= k**v
    ans += t
ans %= MOD
print(ans)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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

ans = 0
for a in A:
    ans += lcm // a
ans %= MOD
print(ans)

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

MAXN = 10**6+10
facts = [-1,-1] + [0]*MAXN
p = 2
while p*p <= MAXN:
    if facts[p] == 0:
        for q in range(p*p,MAXN+1,p):
            if facts[q]==0:
                facts[q] = p
    p += 1

from collections import Counter
ctr = Counter()
cs = [Counter() for i in range(N)]
for i,a in enumerate(A):
    while facts[a] > 0:
        cs[i][facts[a]] += 1
        a //= facts[a]
    cs[i][a] += 1
    ctr |= cs[i]

ans = 0
for c in cs:
    t = 1
    for k,v in (ctr - c).items():
        t *= k**v
    ans += t
ans %= MOD
print(ans)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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

ans = 0
for a in A:
    ans += lcm // a
ans %= MOD
print(ans)

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

MAXN = 10**6+10
facts = [-1,-1] + [0]*MAXN
p = 2
while p*p <= MAXN:
    if facts[p] == 0:
        for q in range(p*p,MAXN+1,p):
            if facts[q]==0:
                facts[q] = p
    p += 1

from collections import Counter
ctr = Counter()
cs = [Counter() for i in range(N)]
for i,a in enumerate(A):
    while facts[a] > 0:
        cs[i][facts[a]] += 1
        a //= facts[a]
    cs[i][a] += 1
    ctr |= cs[i]

ans = 0
for c in cs:
    t = 1
    for k,v in (ctr - c).items():
        t *= k**v
    ans += t
ans %= MOD
print(ans)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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

ans = 0
for a in A:
    ans += lcm // a
ans %= MOD
print(ans)

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

MAXN = 10**6+10
facts = [-1,-1] + [0]*MAXN
p = 2
while p*p <= MAXN:
    if facts[p] == 0:
        for q in range(p*p,MAXN+1,p):
            if facts[q]==0:
                facts[q] = p
    p += 1

from collections import Counter
ctr = Counter()
for a in A:
    c = Counter()
    while facts[a] > 0:
        c[facts[a]] += 1
        a //= facts[a]
    c[a] += 1
    ctr |= c

ans = 0
for a in A:
    c = Counter()
    while facts[a] > 0:
        c[facts[a]] += 1
        a //= facts[a]
    c[a] += 1
    t = 1
    for k,v in (ctr - c).items():
        t *= k**v
    ans += t
ans %= MOD
print(ans)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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

ans = 0
for a in A:
    ans += lcm // a
ans %= MOD
print(ans)

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

MAXN = 10**6+10
facts = [-1,-1] + [0]*MAXN
p = 2
while p*p <= MAXN:
    if facts[p] == 0:
        for q in range(p*p,MAXN+1,p):
            if facts[q]==0:
                facts[q] = p
    p += 1

from collections import Counter
ctr = Counter()
for a in A:
    c = Counter()
    while facts[a] > 0:
        c[facts[a]] += 1
        a //= facts[a]
    c[a] += 1
    ctr |= c
l = 1
for k,v in ctr.items():
    l *= k**v
ans = 0
for a in A:
    ans += l//a
ans %= MOD
print(ans)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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

ans = 0
for a in A:
    ans += lcm // a
ans %= MOD
print(ans)

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

MAXN = 10**6+10
facts = [-1,-1] + [0]*MAXN
p = 2
while p*p <= MAXN:
    if facts[p] == 0:
        for q in range(p*p,MAXN+1,p):
            if facts[q]==0:
                facts[q] = p
    p += 1

from collections import Counter
ctr = Counter()
for a in A:
    c = Counter()
    while facts[a] > 0:
        c[facts[a]] += 1
        a //= facts[a]
    c[a] += 1
    ctr |= c
l = 1
for k,v in ctr.items():
    l *= k**v
ans = 0
for a in A:
    ans += l//a
    ans %= MOD
print(ans)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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

ans = 0
for a in A:
    ans += lcm // a
ans %= MOD
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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

ans = 0
for a in A:
    ans += lcm // a
    ans %= MOD
print(ans)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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

ans = 0
for a in A:
    ans += lcm // a
ans %= MOD
print(ans)

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

from collections import Counter
def factorize(n):
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m += 1
    if n > 1:
        d[n] += 1
    return d

factors = [None] * N

lcms = Counter()
for i,a in enumerate(A):
    factors[i] = factorize(a)
    for k,v in factors[i].items():
        if k in lcms:
            lcms[k] = max(lcms[k], v)
        else:
            lcms[k] = v

ans = 0
for fs in factors:
    a = 1
    for k,v in lcms.items():
        a *= pow(k, v - fs[k], MOD)
        a %= MOD
    ans += a
    ans %= MOD
print(ans)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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

ans = 0
for a in A:
    ans += lcm // a
ans %= MOD
print(ans)

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

from collections import Counter
def factorize(n):
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m += 1
    if n > 1:
        d[n] += 1
    return d

factors = [None] * N

lcms = Counter()
for i,a in enumerate(A):
    factors[i] = factorize(a)
    for k,v in factors[i].items():
        if k in lcms:
            lcms[k] = max(lcms[k], v)
        else:
            lcms[k] = v

ans = 0
for fs in factors:
    a = 1
    for k,v in lcms.items():
        a *= pow(k, v - fs[k], MOD)
    ans += a
    ans %= MOD
print(ans)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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

ans = 0
for a in A:
    ans += lcm // a
ans %= MOD
print(ans)

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

from collections import Counter
def factorize(n):
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m += 1
    if n > 1:
        d[n] += 1
    return d

factors = [None] * N

lcms = Counter()
for i,a in enumerate(A):
    factors[i] = factorize(a)
    for k,v in factors[i].items():
        if k in lcms:
            lcms[k] = max(lcms[k], v)
        else:
            lcms[k] = v

ans = 0
for fs in factors:
    a = 1
    for k,v in lcms.items():
        a *= pow(k, v - fs[k], MOD)
    ans += a
    ans %= MOD
print(ans)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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

ans = 0
for a in A:
    ans += lcm // a
ans %= MOD
print(ans)

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

from collections import Counter
def factorize(n):
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m += 1
    if n > 1:
        d[n] += 1
    return d

factors = [None] * N

lcms = Counter()
for i,a in enumerate(A):
    factors[i] = factorize(a)
    for k,v in factors[i].items():
        if k in lcms:
            lcms[k] = max(lcms[k], v)
        else:
            lcms[k] = v

ans = 0
for fs in factors:
    a = 1
    for k,v in lcms.items():
        a *= k**(v - fs[k])
        a %= MOD
    ans += a
    ans %= MOD
print(ans)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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

ans = 0
for a in A:
    ans += lcm // a
ans %= MOD
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

from collections import Counter
def factorize(n):
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m += 1
    if n > 1:
        d[n] += 1
    return d

factors = [None] * N

lcms = Counter()
for i,a in enumerate(A):
    factors[i] = factorize(a)
    for k,v in factors[i].items():
        if k in lcms:
            lcms[k] = max(lcms[k], v)
        else:
            lcms[k] = v

ans = 0
for fs in factors:
    a = 1
    for k,v in lcms.items():
        a *= k**(v - fs[k])
    ans += a
    ans %= MOD
print(ans)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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

ans = 0
for a in A:
    ans += lcm // a
ans %= MOD
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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


ans = 0
for a in A:
    ans += lcm // a
    ans %= MOD
print(ans)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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

ans = 0
for a in A:
    ans += lcm // a
ans %= MOD
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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


ans = 0
for a in A:
    ans += lcm // a
    ans %= MOD
print(ans)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

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

ans = 0
for a in A:
    ans += lcm // a
ans %= MOD
print(ans)