Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

import fractions

X = A[0]
for i in range(1, N):
    X = X*A[i] // fractions.gcd(X, A[i]) 

output = 0
D =10**9+7
for i in range(N):
    output += X*pow(A[i],D-2,D)%D
    output = output % (10**9+7)
print(int(output))

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

import fractions

X = A[0]
for i in range(1, N):
    X = X*A[i] // fractions.gcd(X, A[i])

output = 0
D =10**9+7
X = X%D

for i in range(N):
    output += X*pow(A[i],D-2,D)%D
    output = output % (10**9+7)
print(int(output))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

import fractions

X = A[0]
for i in range(1, N):
    X = X // fractions.gcd(X, A[i]) * A[i]

output = 0
D =10**9+7
for i in range(N):
    output += X*pow(A[i],D-2,D)%D
    output = output % (10**9+7)
print(int(output))

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

import fractions

X = A[0]
for i in range(1, N):
    X = X*A[i] // fractions.gcd(X, A[i])

output = 0
D =10**9+7
X = X%D

for i in range(N):
    output += X*pow(A[i],D-2,D)%D
    output = output % (10**9+7)
print(int(output))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)

X = A[0]
for i in range(1, N):
    X = X // gcd(X, A[i]) * A[i]

output = 0
for i in range(N):
    output += X*pow(A[i],10**9+5,10**9+7)%(10**9+7)
    output = output % (10**9+7)
print(output)

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

import fractions

X = A[0]
for i in range(1, N):
    X = X*A[i] // fractions.gcd(X, A[i])

output = 0
D =10**9+7
X = X%D

for i in range(N):
    output += X*pow(A[i],D-2,D)%D
    output = output % (10**9+7)
print(int(output))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
import fractions
X = A[0]
for i in range(1, N):
    X = X // fractions.gcd(X, A[i]) * A[i]

output = 0
for i in range(N):
    output += X*pow(A[i],10**9+5,10**9+7)%(10**9+7)
    output = output % (10**9+7)
print(output)

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

import fractions

X = A[0]
for i in range(1, N):
    X = X*A[i] // fractions.gcd(X, A[i])

output = 0
D =10**9+7
X = X%D

for i in range(N):
    output += X*pow(A[i],D-2,D)%D
    output = output % (10**9+7)
print(int(output))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

def P(m):
    pf={}
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:
        pf[m]=1
    return pf

dictlist = []
for i in range(N):
    dictlist.append(P(A[i]))

dict = dictlist[0].copy()
for i in range(1,N):
    new = dictlist[i]
    for k in new.keys():
        if k not in dict:
            dict[k]=new[k]
        elif dict[k]<new[k]:
            dict[k]=new[k]

output = 0
for i in range(N):
    out = 1
    tmp = dictlist[i]
    for k in dict.keys():
        if k in tmp:
            G = dict[k]-tmp[k]
        else:
            G = dict[k]
        out *= int(k)**G %(10**9+7)
    output += out %(10**9+7)
    output = output % (10**9+7)
print(output)

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

import fractions

X = A[0]
for i in range(1, N):
    X = X*A[i] // fractions.gcd(X, A[i])

output = 0
D =10**9+7
X = X%D

for i in range(N):
    output += X*pow(A[i],D-2,D)%D
    output = output % (10**9+7)
print(int(output))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

def P(m):
    pf={}
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:
        pf[m]=1
    return pf

dictlist = []
for i in range(N):
    dictlist.append(P(A[i]))

dict = dictlist[0].copy()
for i in range(1,N):
    new = dictlist[i]
    for k in new.keys():
        if k not in dict:
            dict[k]=new[k]
        elif dict[k]<new[k]:
            dict[k]=new[k]

output = 0
for i in range(N):
    tdict = dict.copy()
    out = 1
    tmp = dictlist[i]
    for k in tmp.keys():
        tdict[k] = tdict[k]-tmp[k]
    for k in tdict.keys():
        out *= int(k)**tdict[k] %(10**9+7)
    output += out %(10**9+7)
    output = output % (10**9+7)
print(output)

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

import fractions

X = A[0]
for i in range(1, N):
    X = X*A[i] // fractions.gcd(X, A[i])

output = 0
D =10**9+7
X = X%D

for i in range(N):
    output += X*pow(A[i],D-2,D)%D
    output = output % (10**9+7)
print(int(output))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
A.sort()
import fractions
X1 = A[0]
Y = 1
for i in range(1, N):
    X2 = X1 // fractions.gcd(X1, A[i]) * A[i]
    Y *= int(X2/X1)
    Y += int(X2/A[i])
    Y = Y%(10**9+7)
    X1 = X2
print(Y)

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

import fractions

X = A[0]
for i in range(1, N):
    X = X*A[i] // fractions.gcd(X, A[i])

output = 0
D =10**9+7
X = X%D

for i in range(N):
    output += X*pow(A[i],D-2,D)%D
    output = output % (10**9+7)
print(int(output))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
import fractions
X1 = A[0]
Y = 1
for i in range(1, N):
    X2 = X1 // fractions.gcd(X1, A[i]) * A[i]
    Y *= int(X2/X1)
    Y += int(X2/A[i])
    Y = Y%(10**9+7)
    X1 = X2
print(Y)

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

import fractions

X = A[0]
for i in range(1, N):
    X = X*A[i] // fractions.gcd(X, A[i])

output = 0
D =10**9+7
X = X%D

for i in range(N):
    output += X*pow(A[i],D-2,D)%D
    output = output % (10**9+7)
print(int(output))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
import fractions
X = A[0]
for i in range(1, N):
    X = X // fractions.gcd(X, A[i]) * A[i] 

output = 0
for i in range(N):
    output += int(X/A[i])%(10**9+7)
    if output > 10**9+7:
        output = output % (10**9+7)
print(output)


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

import fractions

X = A[0]
for i in range(1, N):
    X = X*A[i] // fractions.gcd(X, A[i])

output = 0
D =10**9+7
X = X%D

for i in range(N):
    output += X*pow(A[i],D-2,D)%D
    output = output % (10**9+7)
print(int(output))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
import fractions
X = A[0]
for i in range(1, N):
    X = X // fractions.gcd(X, A[i]) * A[i] 

output = 0
for i in range(N):
    output += int(X/A[i])%(10**9+7)
    if output > 10**9+7:
        output = output % (10**9+7)
print(output)

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

import fractions

X = A[0]
for i in range(1, N):
    X = X*A[i] // fractions.gcd(X, A[i])

output = 0
D =10**9+7
X = X%D

for i in range(N):
    output += X*pow(A[i],D-2,D)%D
    output = output % (10**9+7)
print(int(output))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
import fractions
X = A[0]
for i in range(1, N):
    X = X * A[i] // fractions.gcd(X, A[i])

output = 0
for i in range(N):
    output += int(X/A[i])
    if output > 10**9+7:
        output = output % (10**9+7)
print(output)

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

import fractions

X = A[0]
for i in range(1, N):
    X = X*A[i] // fractions.gcd(X, A[i])

output = 0
D =10**9+7
X = X%D

for i in range(N):
    output += X*pow(A[i],D-2,D)%D
    output = output % (10**9+7)
print(int(output))