Buggy python submission (verdict: Time Limit Exceeded):
import fractions
N = int(input())
A = [int(i) for i in input().split()]

mod = 10**9 + 7


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

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


Fixed submission:
import functools
import fractions
N = int(input())
A = [int(i) for i in input().split()]
S = set(A)


mod = 10**9 + 7


def multiple(a, b):
    return a*b // fractions.gcd(a, b)


def lcm(nums):
    return functools.reduce(multiple, nums)


lcm = lcm(S)

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

Buggy python submission (verdict: Time Limit Exceeded):
import functools
import fractions
N = int(input())
A = [int(i) for i in input().split()]
S = set(A)


mod = 10**9 + 7


def multiple(a, b):
    return a*b // fractions.gcd(a, b)


def lcm(nums):
    return functools.reduce(multiple, nums)


lcm = lcm(S)

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


Fixed submission:
import functools
import fractions
N = int(input())
A = [int(i) for i in input().split()]
S = set(A)


mod = 10**9 + 7


def multiple(a, b):
    return a*b // fractions.gcd(a, b)


def lcm(nums):
    return functools.reduce(multiple, nums)


lcm = lcm(S)

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

Buggy python submission (verdict: Time Limit Exceeded):
import functools
# import collections
import fractions
N = int(input())
A = [int(i) for i in input().split()]
S = set(A)


mod = 10**9 + 7


def multiple(a, b):
    return a*b // fractions.gcd(a, b)


def lcm(nums):
    return functools.reduce(multiple, nums)


lcm = lcm(S)

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


Fixed submission:
import functools
import fractions
N = int(input())
A = [int(i) for i in input().split()]
S = set(A)


mod = 10**9 + 7


def multiple(a, b):
    return a*b // fractions.gcd(a, b)


def lcm(nums):
    return functools.reduce(multiple, nums)


lcm = lcm(S)

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

Buggy python submission (verdict: Time Limit Exceeded):
import functools
import collections
import fractions
N = int(input())
A = [int(i) for i in input().split()]


C = collections.Counter(A)

mod = 10**9 + 7

# lcm = 1
# for a in C.keys():
#     lcm = lcm*a//fractions.gcd(lcm, a)
# print(lcm)


def multiple(a, b):
    return a*b // fractions.gcd(a, b)


def lcm(nums):
    return functools.reduce(multiple, nums)


lcm = lcm(list(C.keys()))

ans = 0
for k, v in C.items():
    ans += lcm//k*v
    ans %= mod
print(ans)


Fixed submission:
import functools
import fractions
N = int(input())
A = [int(i) for i in input().split()]
S = set(A)


mod = 10**9 + 7


def multiple(a, b):
    return a*b // fractions.gcd(a, b)


def lcm(nums):
    return functools.reduce(multiple, nums)


lcm = lcm(S)

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

Buggy python submission (verdict: Time Limit Exceeded):
import collections
import fractions
N = int(input())
A = [int(i) for i in input().split()]


C = collections.Counter(A)

mod = 10**9 + 7

lcm = 1
for a in C.keys():
    lcm = lcm*a//fractions.gcd(lcm, a)
# print(lcm)

ans = 0
for k, v in C.items():
    ans += lcm//k*v
    ans %= mod
print(ans)


Fixed submission:
import functools
import fractions
N = int(input())
A = [int(i) for i in input().split()]
S = set(A)


mod = 10**9 + 7


def multiple(a, b):
    return a*b // fractions.gcd(a, b)


def lcm(nums):
    return functools.reduce(multiple, nums)


lcm = lcm(S)

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

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
N = int(input())
A = [int(i) for i in input().split()]

mod = 10**9 + 7


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

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


Fixed submission:
import functools
import fractions
N = int(input())
A = [int(i) for i in input().split()]
S = set(A)


mod = 10**9 + 7


def multiple(a, b):
    return a*b // fractions.gcd(a, b)


def lcm(nums):
    return functools.reduce(multiple, nums)


lcm = lcm(S)

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