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

#arr：最小公倍数の対象とする配列
MOD = 10**9 + 7
def lcm(arr):
    primes = {}
    for val in arr:
        p = 2
        while p * p <= val:
            if val % p == 0:
                cnt = 0
                while val % p == 0:
                    cnt += 1
                    val //= p
                if p not in primes:
                    primes[p] = cnt
                else:
                    primes[p] = max(cnt, primes[p])
            p += 1
     
        if val != 1:
            if val not in primes:
                primes[val] = 1
    lcma = 1
    for p in primes:
        lcma = lcma * pow(p, primes[p], MOD) 
    return lcma

b = lcm(arr)

ans=0
for i in range(n):
    ans+=(b//arr[i])%MOD

print(ans%MOD)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
 
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
 
a = 1
for i in range(N):
    a = lcm(a, A[i])
 
ans = 0
for i in range(N):
    ans += a * pow(A[i], mod-2, mod)
 
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
import fractions 
from functools import reduce
arr = list(map(int,input().split()))
 
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
def lcm(numbers):
    return reduce(lcm_base, numbers, 1)
    
a = lcm(arr)
 
ans = 0
 
for i in range(n):
    ans+= a//arr[i]
    
print(ans %(1000000000+7))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
 
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
 
a = 1
for i in range(N):
    a = lcm(a, A[i])
 
ans = 0
for i in range(N):
    ans += a * pow(A[i], mod-2, mod)
 
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
import fractions 
from functools import reduce
arr = list(map(int,input().split()))

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

def lcma(numbers):
    return reduce(lcm_base, numbers, 1)
 
a = lcma(arr)
ans = [(a//i)%1000000007 for i in arr]
cnt=0
for i in ans:cnt = cnt+ i %1000000007
print(cnt%1000000007)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
 
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
 
a = 1
for i in range(N):
    a = lcm(a, A[i])
 
ans = 0
for i in range(N):
    ans += a * pow(A[i], mod-2, mod)
 
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
import fractions 
from functools import reduce
arr = list(map(int,input().split()))

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

def lcma(numbers):
    return reduce(lcm_base, numbers, 1)
 
a = lcma(arr)
ans = [(a//i)%1000000007 for i in arr]
cnt=0
for i in ans:cnt = cnt+ i %1000000007
print(cnt%1000000007)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
 
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
 
a = 1
for i in range(N):
    a = lcm(a, A[i])
 
ans = 0
for i in range(N):
    ans += a * pow(A[i], mod-2, mod)
 
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
import fractions 
from functools import reduce
arr = list(map(int,input().split()))

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

def lcma(numbers):
    return reduce(lcm_base, numbers, 1)
 
a = lcma(arr)

ans = [(a//i)%1000000007 for i in arr]
cnt=0
for i in ans:
    cnt += i %1000000007

print(cnt%1000000007)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
 
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
 
a = 1
for i in range(N):
    a = lcm(a, A[i])
 
ans = 0
for i in range(N):
    ans += a * pow(A[i], mod-2, mod)
 
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
import fractions 
from functools import reduce
arr = list(map(int,input().split()))

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

def lcma(numbers):
    return reduce(lcm_base, numbers, 1)
  
a = lcma(arr)

ans = [(a//i)%1000000007 for i in arr]

print(sum(ans)%1000000007)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
 
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
 
a = 1
for i in range(N):
    a = lcm(a, A[i])
 
ans = 0
for i in range(N):
    ans += a * pow(A[i], mod-2, mod)
 
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
import fractions 
from functools import reduce
arr = list(map(int,input().split()))

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

def lcma(numbers):
    return reduce(lcm_base, numbers, 1)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)    
a = lcma(arr)
ans = 0

for i in arr:
    ans+= (a//i)%1000000007
print(ans%1000000007)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
 
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
 
a = 1
for i in range(N):
    a = lcm(a, A[i])
 
ans = 0
for i in range(N):
    ans += a * pow(A[i], mod-2, mod)
 
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
import fractions 
from functools import reduce
arr = list(map(int,input().split()))

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

def lcma(numbers):
    return reduce(lcm_base, numbers, 1)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)    
a = lcm(*arr)
ans = 0

for i in arr:
    ans+= (a//i)%1000000007
    ans=ans%1000000007
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
 
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
 
a = 1
for i in range(N):
    a = lcm(a, A[i])
 
ans = 0
for i in range(N):
    ans += a * pow(A[i], mod-2, mod)
 
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
import fractions 
from functools import reduce
arr = list(map(int,input().split()))


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

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)
    
a = lcm(arr)
ans = []
for i in arr:
    ans.append((a//i)%1000000007)

print(sum(ans)%1000000007)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
 
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
 
a = 1
for i in range(N):
    a = lcm(a, A[i])
 
ans = 0
for i in range(N):
    ans += a * pow(A[i], mod-2, mod)
 
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
import fractions 
from functools import reduce
arr = list(map(int,input().split()))


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

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)
    
a = lcm(arr)

ans = 0

for i in arr:
    ans+= (a//i)%1000000007
    if ans >=1000000007:
        ans % 1000000007
print(ans %(1000000000+7))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
 
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
 
a = 1
for i in range(N):
    a = lcm(a, A[i])
 
ans = 0
for i in range(N):
    ans += a * pow(A[i], mod-2, mod)
 
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
import fractions 
from functools import reduce
arr = list(map(int,input().split()))


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

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)
    
a = lcm(arr)

ans = 0

for i in arr:
    ans+= a//i
    if ans >1000000007:
        ans % 1000000007
print(ans %(1000000000+7))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
 
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
 
a = 1
for i in range(N):
    a = lcm(a, A[i])
 
ans = 0
for i in range(N):
    ans += a * pow(A[i], mod-2, mod)
 
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
import fractions 
from functools import reduce
arr = list(map(int,input().split()))


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

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)
    
a = lcm(arr)

ans = 0

for i in arr:
    ans+= a//i
    
print(ans %(1000000000+7))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
 
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
 
a = 1
for i in range(N):
    a = lcm(a, A[i])
 
ans = 0
for i in range(N):
    ans += a * pow(A[i], mod-2, mod)
 
print(ans % mod)