Buggy python submission (verdict: Runtime Error):
MOD=10**9+7
def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        if(tmp%i==0):
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if(not arr):
        arr.append([1,1])
    if(tmp!=1):
        arr.append([tmp,1])
    return arr
def moddiv(a,m):
    return pow(a,m-2,m)
N=int(input())
A=list(map(int,input().split()))
cnt=[0]*1001
for i in range(N):
    arr=factorization(A[i])
    for a,b in arr:
        cnt[a]=max(cnt[a],b)
g=1;res=0
for i in range(1001):
    g=g*(pow(i,cnt[i],MOD))%MOD
for i in range(N):
    res=(res+(g*moddiv(A[i],MOD))%MOD)%MOD
print(res)

Fixed submission:
MOD=10**9+7
def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        if(tmp%i==0):
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if(not arr):
        arr.append([1,1])
    if(tmp!=1):
        arr.append([tmp,1])
    return arr
def moddiv(a,m):
    return pow(a,m-2,m)
N=int(input())
A=list(map(int,input().split()))
cnt={}
for i in range(N):
    arr=factorization(A[i])
    for a,b in arr:
        cnt[a]=max(cnt.get(a,0),b)
g=1;res=0
for k,v in cnt.items():
    g=g*(pow(k,v,MOD))%MOD
for i in range(N):
    res=(res+(g*moddiv(A[i],MOD))%MOD)%MOD
print(res)

Buggy python submission (verdict: Runtime Error):
MOD=10**9+7
def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        if(tmp%i==0):
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if(not arr):
        arr.append([1,1])
    if(tmp!=1):
        arr.append([tmp,1])
    return arr
def moddiv(a,m):
    return pow(a,m-2,m)
N=int(input())
A=list(map(int,input().split()))
cnt=[0]*1001
for i in range(N):
    arr=factorization(A[i])
    for a,b in arr:
        cnt[a]=max(cnt[a],b)
g=1;res=0
for i in range(1001):
    g=g*(i**cnt[i])%MOD
for i in range(N):
    res=(res+g*moddiv(A[i],MOD))%MOD
print(res)

Fixed submission:
MOD=10**9+7
def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        if(tmp%i==0):
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if(not arr):
        arr.append([1,1])
    if(tmp!=1):
        arr.append([tmp,1])
    return arr
def moddiv(a,m):
    return pow(a,m-2,m)
N=int(input())
A=list(map(int,input().split()))
cnt={}
for i in range(N):
    arr=factorization(A[i])
    for a,b in arr:
        cnt[a]=max(cnt.get(a,0),b)
g=1;res=0
for k,v in cnt.items():
    g=g*(pow(k,v,MOD))%MOD
for i in range(N):
    res=(res+(g*moddiv(A[i],MOD))%MOD)%MOD
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
MOD=10**9+7
import sys
read=sys.stdin.readline
from fractions import gcd
from collections import deque
def lcm(a,b):
    return(a//gcd(a,b)*b)
def main():
    N=int(input())
    A=list(map(int,read().split()))
    d=deque(A)
    while(len(d)>1):
        a,b=d.popleft(),d.popleft()
        d.append(lcm(a,b))
    g=d[0]
    res=0
    for i in range(N):
        res=(res+g//A[i])%MOD
    print(res)
    
if __name__=='__main__':
    main()

Fixed submission:
MOD=10**9+7
def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        if(tmp%i==0):
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if(not arr):
        arr.append([1,1])
    if(tmp!=1):
        arr.append([tmp,1])
    return arr
def moddiv(a,m):
    return pow(a,m-2,m)
N=int(input())
A=list(map(int,input().split()))
cnt={}
for i in range(N):
    arr=factorization(A[i])
    for a,b in arr:
        cnt[a]=max(cnt.get(a,0),b)
g=1;res=0
for k,v in cnt.items():
    g=g*(pow(k,v,MOD))%MOD
for i in range(N):
    res=(res+(g*moddiv(A[i],MOD))%MOD)%MOD
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
MOD=10**9+7
import sys
read=sys.stdin.readline
from fractions import gcd
from collections import deque
def lcm(a,b):
    return(a//gcd(a,b)*b)
def main():
    N=int(input())
    A=list(map(int,read().split()))
    d=deque(A)
    while(len(d)>1):
        a,b=d.popleft(),d.popleft()
        d.append(lcm(a,b))
    g=d[0]
    res=0
    for i in range(N):
        res=(res+g//A[i])%MOD
    print(res)
    
if __name__=='__main__':
    main()

Fixed submission:
MOD=10**9+7
def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        if(tmp%i==0):
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if(not arr):
        arr.append([1,1])
    if(tmp!=1):
        arr.append([tmp,1])
    return arr
def moddiv(a,m):
    return pow(a,m-2,m)
N=int(input())
A=list(map(int,input().split()))
cnt={}
for i in range(N):
    arr=factorization(A[i])
    for a,b in arr:
        cnt[a]=max(cnt.get(a,0),b)
g=1;res=0
for k,v in cnt.items():
    g=g*(pow(k,v,MOD))%MOD
for i in range(N):
    res=(res+(g*moddiv(A[i],MOD))%MOD)%MOD
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
MOD=10**9+7
from fractions import gcd
def lcm(a,b):
    return(a//gcd(a,b)*b)
N=int(input())
A=list(map(int,input().split()))
g=1
for i in range(N):
    g=lcm(g,A[i])
res=0
for i in range(N):
    res=(res+g//A[i])%MOD
print(res)

Fixed submission:
MOD=10**9+7
def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        if(tmp%i==0):
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if(not arr):
        arr.append([1,1])
    if(tmp!=1):
        arr.append([tmp,1])
    return arr
def moddiv(a,m):
    return pow(a,m-2,m)
N=int(input())
A=list(map(int,input().split()))
cnt={}
for i in range(N):
    arr=factorization(A[i])
    for a,b in arr:
        cnt[a]=max(cnt.get(a,0),b)
g=1;res=0
for k,v in cnt.items():
    g=g*(pow(k,v,MOD))%MOD
for i in range(N):
    res=(res+(g*moddiv(A[i],MOD))%MOD)%MOD
print(res)

Buggy python submission (verdict: Runtime Error):
import math
import fractions
N=int(input())
A=list(map(int,input().split()))
tmp=A[0]
ans=0

for i in range(N):
    tmp=math.floor((tmp*A[i])/(fractions.gcd(tmp,A[i])))

for i in range(N):
    ans+=(tmp/A[i])
    ans%=1000000007
    
print(int(ans))

Fixed submission:
MOD=10**9+7
def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        if(tmp%i==0):
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if(not arr):
        arr.append([1,1])
    if(tmp!=1):
        arr.append([tmp,1])
    return arr
def moddiv(a,m):
    return pow(a,m-2,m)
N=int(input())
A=list(map(int,input().split()))
cnt={}
for i in range(N):
    arr=factorization(A[i])
    for a,b in arr:
        cnt[a]=max(cnt.get(a,0),b)
g=1;res=0
for k,v in cnt.items():
    g=g*(pow(k,v,MOD))%MOD
for i in range(N):
    res=(res+(g*moddiv(A[i],MOD))%MOD)%MOD
print(res)

Buggy python submission (verdict: Runtime Error):
import math
N=int(input())
A=list(map(int,input().split()))
tmp=A[0]
ans=0

for i in range(N):
    tmp=math.floor((tmp*A[i])/(math.gcd(tmp,A[i])))

for i in range(N):
    ans+=(tmp/A[i])
    ans%=1000000007
    
print(int(ans))

Fixed submission:
MOD=10**9+7
def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        if(tmp%i==0):
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if(not arr):
        arr.append([1,1])
    if(tmp!=1):
        arr.append([tmp,1])
    return arr
def moddiv(a,m):
    return pow(a,m-2,m)
N=int(input())
A=list(map(int,input().split()))
cnt={}
for i in range(N):
    arr=factorization(A[i])
    for a,b in arr:
        cnt[a]=max(cnt.get(a,0),b)
g=1;res=0
for k,v in cnt.items():
    g=g*(pow(k,v,MOD))%MOD
for i in range(N):
    res=(res+(g*moddiv(A[i],MOD))%MOD)%MOD
print(res)