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


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

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

ans = 0
for a in A:
    ans += lcm // a
    ans %= mod

print(ans)

Fixed submission:
import sys
import fractions
input = sys.stdin.readline


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

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

ans = 0
for a in A:
    ans += lcm // a

print(ans % mod)

Buggy python submission (verdict: Runtime Error):
import sys
import math
input = sys.stdin.readline


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

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

ans = 0
for a in A:
    ans += lcm // a
    ans %= mod

print(ans)

Fixed submission:
import sys
import fractions
input = sys.stdin.readline


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

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

ans = 0
for a in A:
    ans += lcm // a

print(ans % mod)

Buggy python submission (verdict: Runtime Error):
import sys
import math
input = sys.stdin.readline


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

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

ans = 0
for a in A:
    ans += lcm // a

print(ans % mod)

Fixed submission:
import sys
import fractions
input = sys.stdin.readline


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

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

ans = 0
for a in A:
    ans += lcm // a

print(ans % mod)

Buggy python submission (verdict: Runtime Error):
import sys
import math
input = sys.stdin.readline


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

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

ans = 0
for a in A:
    ans += lcm // a

print(ans % mod)

Fixed submission:
import sys
import fractions
input = sys.stdin.readline


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

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

ans = 0
for a in A:
    ans += lcm // a

print(ans % mod)

Buggy python submission (verdict: Runtime Error):
import sys
import math
input = sys.stdin.readline


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

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

ans = 0
for a in A:
    ans += lcm // a

print(ans % mod)

Fixed submission:
import sys
import fractions
input = sys.stdin.readline


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

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

ans = 0
for a in A:
    ans += lcm // a

print(ans % mod)

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

mod = 10 ** 9 + 7
def modpow(a, x):
    if a == 0:
        return 0
    if x == 0:
        return 1
    elif x % 2 == 0:
        return modpow((a * a) % mod, x // 2) % mod
    else:
        return (modpow((a * a) % mod , x // 2) % mod * a) % mod


def factorization(x):
    ans = {}
    i = 2
    in_x = x
    while i <= x:
        count = 0
        while x % i == 0:
            x = x // i
            count += 1
        if count > 0:
            ans[i] = count
        i += 1
    return ans


N = int(input())
A = list(map(int, input().split(" ")))
primes = {}
for a in A:
    factors = factorization(a)
    for f in factors:
        if f in primes:
            primes[f] = max(primes[f], factors[f])
        else:
            primes[f] = factors[f]

ans = 0
for a in A:
    factors = factorization(a)
    tmp = 1
    for p in primes:
        if p in factors:
            tmp *= modpow(p, (primes[p] - factors[p]))
        else:
            tmp *= modpow(p, primes[p])
        tmp %= mod
    ans += tmp
    ans %= mod

print(ans)

Fixed submission:
import sys
import fractions
input = sys.stdin.readline


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

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

ans = 0
for a in A:
    ans += lcm // a

print(ans % mod)

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

mod = 10 ** 9 + 7
def modpow(a, x):
    if a == 0:
        return 0
    if x == 0:
        return 1
    elif x % 2 == 0:
        return modpow((a * a) % mod, x // 2) % mod
    else:
        return (modpow((a * a) % mod , x // 2) % mod * a) % mod


def factorization(x):
    ans = []
    i = 2
    in_x = x
    while i <= x:
        count = 0
        while x % i == 0:
            x = x // i
            count += 1
        if count > 0:
            ans.append((i, count))
        i += 1
    return ans


N = int(input())
A = list(map(int, input().split(" ")))
primes = {}
for a in A:
    factors = factorization(a)
    for f in factors:
        if f[0] in primes:
            primes[f[0]] = max(primes[f[0]], f[1])
        else:
            primes[f[0]] = f[1]

lcm = 1
for p in primes:
    lcm *= modpow(p, primes[p])
    lcm %= mod

ans = 0
for a in A:
    ans += (lcm * modpow(a, mod - 2)) % mod
    ans %= mod
print(ans)

Fixed submission:
import sys
import fractions
input = sys.stdin.readline


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

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

ans = 0
for a in A:
    ans += lcm // a

print(ans % mod)

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

mod = 10 ** 9 + 7
def modpow(a, x):
    if a == 0:
        return 0
    if x == 0:
        return 1
    elif x % 2 == 0:
        return modpow((a * a) % mod, x // 2) % mod
    else:
        return (modpow((a * a) % mod , x // 2) % mod * a) % mod


def factorization(x):
    ans = []
    i = 2
    in_x = x
    while i <= x:
        count = 0
        while x % i == 0:
            x = x // i
            count += 1
        if count > 0:
            ans.append((i, count))
        i += 1
    return ans


N = int(input())
A = list(map(int, input().split(" ")))
primes = {}
for a in A:
    factors = factorization(a)
    for f in factors:
        if f[0] in primes:
            primes[f[0]] = max(primes[f[0]], f[1])
        else:
            primes[f[0]] = f[1]

lcm = 1
for p in primes:
    lcm *= modpow(p, primes[p])
    lcm %= mod


ans = 0
for a in A:
    ans += (lcm * modpow(a, mod - 2)) % mod
    ans %= mod
print(ans)

Fixed submission:
import sys
import fractions
input = sys.stdin.readline


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

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

ans = 0
for a in A:
    ans += lcm // a

print(ans % mod)

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

mod = 10 ** 9 + 7
def modpow(a, x):
    if a == 0:
        return 0
    if x == 0:
        return 1
    elif x % 2 == 0:
        return modpow((a * a) % mod, x // 2) % mod
    else:
        return (modpow((a * a) % mod , x // 2) % mod * a) % mod


rev = [modpow(i, mod - 2) % mod for i in range(10 ** 6 + 1)]
N = int(input())
A = list(map(int, input().split(" ")))
lcm = 1
for a in A:
    lcm = lcm * a * rev[fractions.gcd(lcm, a)]
print(lcm % mod)

ans = 0
for a in A:
    ans += (lcm * rev[a]) % mod
    ans %= mod
print(ans)

Fixed submission:
import sys
import fractions
input = sys.stdin.readline


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

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

ans = 0
for a in A:
    ans += lcm // a

print(ans % mod)

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

mod = 10 ** 9 + 7
def modpow(a, x):
    if a == 0:
        return 0
    if x == 0:
        return 1
    elif x % 2 == 0:
        return modpow((a * a) % mod, x // 2) % mod
    else:
        return (modpow((a * a) % mod , x // 2) % mod * a) % mod


rev = [modpow(i, mod - 2) % mod for i in range(10 ** 6 + 1)]
N = int(input())
A = list(map(int, input().split(" ")))
lcm = 1
for a in A:
    lcm = lcm * a * rev[fractions.gcd(lcm, a)]
print(lcm % mod)

ans = 0
for a in A:
    ans += (lcm * rev[a]) % mod
    ans %= mod
print(ans)

Fixed submission:
import sys
import fractions
input = sys.stdin.readline


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

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

ans = 0
for a in A:
    ans += lcm // a

print(ans % mod)

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

mod = 10 ** 9 + 7
def modpow(a, x):
    if a == 0:
        return 0
    if x == 0:
        return 1
    elif x % 2 == 0:
        return modpow((a * a) % mod, x // 2) % mod
    else:
        return (modpow((a * a) % mod , x // 2) % mod * a) % mod


rev = [modpow(i, mod - 2) % mod for i in range(10 ** 6 + 1)]
N = int(input())
A = list(map(int, input().split(" ")))
lcm = 1
for a in A:
    lcm = lcm * a * rev[fractions.gcd(lcm, a)]
print(lcm % mod)

ans = 0
for a in A:
    ans += (lcm * rev[a]) % mod
    ans %= mod
print(ans)

Fixed submission:
import sys
import fractions
input = sys.stdin.readline


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

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

ans = 0
for a in A:
    ans += lcm // a

print(ans % mod)