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


def lcm(x, y):
    return x // gcd(x, y) * y


def greatLcm(array):
    ans = 1
    for i in array:
        ans = lcm(ans, i)
    return ans


mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
p = greatLcm(a)
ans = 0
for j in a:
    ans += p // j
    ans %= mod
print(ans)


Fixed submission:
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def solve():
    memo = A[0]
    for i in range(1, N):
        memo = lcm(memo, A[i])

    ans = 0
    for i in range(N):
        ans += memo // A[i]

    return ans % (10 ** 9 + 7)

print(solve())

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


def lcm(x, y):
    return int(x / fractions.gcd(x, y) * y)


mod = 10 ** 9 + 7
n = int(input())
arr = list(map(int, input().split()))
g = arr[0]
for i in range(1, n):
    g = lcm(g, arr[i])

answer = 0
for i in range(n):
    answer += g / arr[i]

print(int(answer % mod))


Fixed submission:
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def solve():
    memo = A[0]
    for i in range(1, N):
        memo = lcm(memo, A[i])

    ans = 0
    for i in range(N):
        ans += memo // A[i]

    return ans % (10 ** 9 + 7)

print(solve())

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


def lcm(x, y):
    return int(x / fractions.gcd(x, y) * y)


mod = 10 ** 9 + 7
n = int(input())
arr = list(map(int, input().split()))
g = arr[0]
for i in range(1, n):
    g = lcm(g, arr[i])

answer = 0
for i in arr:
    answer += g / i

print(int(answer % mod))


Fixed submission:
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def solve():
    memo = A[0]
    for i in range(1, N):
        memo = lcm(memo, A[i])

    ans = 0
    for i in range(N):
        ans += memo // A[i]

    return ans % (10 ** 9 + 7)

print(solve())

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


def lcm(x, y):
    return int(x / gcd(x, y) * y)


def greatLCM(a):
    if len(a) < 2:
        return a[0]
    ans = lcm(a[0], a[1])
    p = 2
    while p < len(a):
        ans = lcm(ans, a[p])
        p += 1
    return ans


mod = 10 ** 9 + 7
n = int(input())
arr = list(map(int, input().split()))
g = greatLCM(arr)
answer = 0
for i in arr:
    answer += g / i

print(int(answer % mod))


Fixed submission:
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def solve():
    memo = A[0]
    for i in range(1, N):
        memo = lcm(memo, A[i])

    ans = 0
    for i in range(N):
        ans += memo // A[i]

    return ans % (10 ** 9 + 7)

print(solve())

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


def lcm(x, y):
    return int(x / gcd(x, y) * y)


def greatLCM(a):
    if len(a) < 2:
        return a[0]
    ans = lcm(a[0], a[1])
    p = 2
    while p < len(a):
        ans = lcm(ans, a[p])
        p += 1
    return ans


mod = 10 ** 9 + 7
n = int(input())
arr = list(map(int, input().split()))
g = greatLCM(arr)
answer = 0
for i in arr:
    answer += g / i
    answer %= mod

print(int(answer))


Fixed submission:
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def solve():
    memo = A[0]
    for i in range(1, N):
        memo = lcm(memo, A[i])

    ans = 0
    for i in range(N):
        ans += memo // A[i]

    return ans % (10 ** 9 + 7)

print(solve())

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


def lcm(x, y):
    return int(x / gcd(x, y) * y)


def greatLCM(a):
    ans = lcm(a[0], a[1])
    p = 2
    while p < len(a):
        ans = lcm(ans, a[p])
        p += 1
    return ans


n = int(input())
arr = list(map(int, input().split()))
g = greatLCM(arr)
answer = 0
for i in arr:
    answer += g / i
    answer %= 10 ** 9 + 7

print(int(answer))


Fixed submission:
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def solve():
    memo = A[0]
    for i in range(1, N):
        memo = lcm(memo, A[i])

    ans = 0
    for i in range(N):
        ans += memo // A[i]

    return ans % (10 ** 9 + 7)

print(solve())

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


def lcm(x, y):
    return int(x / gcd(x, y) * y)


def greatLCM(a):
    ans = lcm(a[0], a[1])
    p = 2
    while p < len(a):
        ans = lcm(ans, a[p])
        p += 1
    return ans


n = int(input())
arr = list(map(int, input().split()))
g = greatLCM(arr)
answer = 0
for i in arr:
    answer += g / i
    answer %= 1e9 + 7

print(int(answer))


Fixed submission:
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def solve():
    memo = A[0]
    for i in range(1, N):
        memo = lcm(memo, A[i])

    ans = 0
    for i in range(N):
        ans += memo // A[i]

    return ans % (10 ** 9 + 7)

print(solve())

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


def lcm(x, y):
    return int(x / gcd(x, y) * y)


def greatLCM(a):
    ans = lcm(a[0], a[1])
    p = 2
    while p < len(a):
        ans = lcm(ans, a[p])
        p += 1
    return ans


n = int(input())
arr = list(map(int, input().split()))
g = greatLCM(arr)
answer = 0
for i in arr:
    answer += g / i
    answer %= 1e9 + 7

print(int(answer))


Fixed submission:
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def solve():
    memo = A[0]
    for i in range(1, N):
        memo = lcm(memo, A[i])

    ans = 0
    for i in range(N):
        ans += memo // A[i]

    return ans % (10 ** 9 + 7)

print(solve())