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


N = int(input())
A = list(map(int, input().split()))
lcm = lambda x, y: x*y//gcd(x, y)
l = 1
for a in A:
    l = lcm(l, a)
ans = 0
MOD = 10**9+7
for a in A:
    ans = (ans + l // a) % MOD 
print(ans)


Fixed submission:
from fractions import gcd


N = int(input())
A = list(map(int, input().split()))
lcm = lambda x, y: x*y//gcd(x, y)
l = 1
for a in A:
    l = lcm(l, a)
ans = 0
MOD = 10**9+7
for a in A:
    ans += l // a
print(ans % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from fractions import gcd
from collections import Counter


def least_common_multiple(iter):
    '''
    最小公倍数を返す
    '''
    lcm = lambda x, y: x*y//gcd(x, y)
    return reduce(lcm, iter)


N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
l = least_common_multiple(list(c.keys()))
ans = 0
MOD = 10**9+7
for k, v in c.items():
    ans = (ans + (l // k * v) % MOD) % MOD
print(ans)


Fixed submission:
from fractions import gcd


N = int(input())
A = list(map(int, input().split()))
lcm = lambda x, y: x*y//gcd(x, y)
l = 1
for a in A:
    l = lcm(l, a)
ans = 0
MOD = 10**9+7
for a in A:
    ans += l // a
print(ans % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from fractions import gcd
from collections import Counter


def least_common_multiple(iter):
    '''
    最小公倍数を返す
    '''
    lcm = lambda x, y: x*y//gcd(x, y)
    return reduce(lcm, iter)


N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
l = least_common_multiple(list(c.keys()))
ans = 0
MOD = 10**9+7
for k, v in c.items():
    ans = (ans + l // k * v) % MOD
print(ans)


Fixed submission:
from fractions import gcd


N = int(input())
A = list(map(int, input().split()))
lcm = lambda x, y: x*y//gcd(x, y)
l = 1
for a in A:
    l = lcm(l, a)
ans = 0
MOD = 10**9+7
for a in A:
    ans += l // a
print(ans % MOD)

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


def least_common_multiple(iter):
    '''
    最小公倍数を返す
    '''
    lcm = lambda x, y: x*y//gcd(x, y)
    return reduce(lcm, iter)


N = int(input())
A = list(map(int, input().split()))
l = least_common_multiple(A)
ans = 0
MOD = 10**9+7
for a in A:
    ans = (ans + l // a) % MOD
print(ans)


Fixed submission:
from fractions import gcd


N = int(input())
A = list(map(int, input().split()))
lcm = lambda x, y: x*y//gcd(x, y)
l = 1
for a in A:
    l = lcm(l, a)
ans = 0
MOD = 10**9+7
for a in A:
    ans += l // a
print(ans % MOD)

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


def least_common_multiple(iter):
    '''
    最小公倍数を返す
    '''
    lcm = lambda x, y: x*y//gcd(x, y)
    return reduce(lcm, iter)


N = int(input())
A = list(map(int, input().split()))
# 全て同じ値
if len(set(A)) == 1:
    print(N)
    exit()
l = least_common_multiple(A)
ans = 0
MOD = 10**9+7
for a in A:
    ans = (ans + l // a) % MOD
print(ans)


Fixed submission:
from fractions import gcd


N = int(input())
A = list(map(int, input().split()))
lcm = lambda x, y: x*y//gcd(x, y)
l = 1
for a in A:
    l = lcm(l, a)
ans = 0
MOD = 10**9+7
for a in A:
    ans += l // a
print(ans % MOD)