Buggy python submission (verdict: Runtime Error):
N = int(input())
A = np.array([int(c) for c in input().split()])
MOD = 10**9+7
U = 10**6+10
B = np.zeros(U)
B[2] = 1
B[3::2] = 1
for i in range(3,U):
  if i*i>U:
    break
  if B[i]:
    B[i*i::i+i] = 0
pls = np.where(B[:1000])[0].tolist()
B = A.copy()
lcm = 1
for p in pls:
  e = 0
  if np.any(A%p==0):
    A[A%p==0] //= p
    e += 1
  lcm *= p**e
  lcm %= MOD
for x in set(A.tolist()):
  lcm *= x
  lcm %= MOD
x = sum(pow(c, MOD-2, MOD) for c in B.tolist())
print(x*lcm%MOD)

Fixed submission:
import numpy as np
N = int(input())
a = np.array(input().split(), np.int64)
MOD = 10**9+7
U = 10**6+10
is_prime = np.zeros(U, np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3, U, 2):
  if p*p>U:
    break
  if is_prime[p]==1:
    is_prime[p*p::p+p] = 0

M = 10**3
small_primes = np.where(is_prime[:M])[0].tolist()

B = a.copy()
lcm = 1
for p in small_primes:
  e = 0
  while np.any(a%p==0):
    a[a%p==0] //= p
    e += 1
  lcm *= p**e
  lcm %= MOD

for x in set(a.tolist()):
  lcm *= x
  lcm %= MOD

answer = sum(pow(x, MOD-2, MOD) for x in B.tolist())%MOD
answer *= lcm
answer %= MOD
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
N = int(input())
a = [int(c) for c in input().split()]
MOD = 10**9+7
dic = defaultdict(int)
ls = defaultdict(int)
for i in range(N):
  c = a[i]
  for j in range(2, int(c**0.5)+1):
    if c%j==0:
      cnt = 0
      while c%j==0:
        c //= j
        cnt += 1
      ls[(i,j)] = cnt
      dic[j] = max(dic[j], cnt)
  if c!=1:
    ls[(i,c)] = 1
    dic[c] = max(dic[c], 1)
ans = 0
for i in range(N):
  b = 1
  for k in dic.keys():
    x = int(k)
    b *= k**(dic[k]-ls[(i,k)])
    b %= MOD
  ans += b
  ans %= MOD
print(ans)


Fixed submission:
import numpy as np
N = int(input())
a = np.array(input().split(), np.int64)
MOD = 10**9+7
U = 10**6+10
is_prime = np.zeros(U, np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3, U, 2):
  if p*p>U:
    break
  if is_prime[p]==1:
    is_prime[p*p::p+p] = 0

M = 10**3
small_primes = np.where(is_prime[:M])[0].tolist()

B = a.copy()
lcm = 1
for p in small_primes:
  e = 0
  while np.any(a%p==0):
    a[a%p==0] //= p
    e += 1
  lcm *= p**e
  lcm %= MOD

for x in set(a.tolist()):
  lcm *= x
  lcm %= MOD

answer = sum(pow(x, MOD-2, MOD) for x in B.tolist())%MOD
answer *= lcm
answer %= MOD
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
import numpy as np
N = int(input())
a = [int(c) for c in input().split()]
mod = 10**9+7
ans = a[0]
b = 0
for i in range(1, N):
  ans = ans*a[i]//gcd(ans, a[i])
a = np.array(a)
a = (ans//a)%mod
b = a.sum()
print(b%mod)

Fixed submission:
import numpy as np
N = int(input())
a = np.array(input().split(), np.int64)
MOD = 10**9+7
U = 10**6+10
is_prime = np.zeros(U, np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3, U, 2):
  if p*p>U:
    break
  if is_prime[p]==1:
    is_prime[p*p::p+p] = 0

M = 10**3
small_primes = np.where(is_prime[:M])[0].tolist()

B = a.copy()
lcm = 1
for p in small_primes:
  e = 0
  while np.any(a%p==0):
    a[a%p==0] //= p
    e += 1
  lcm *= p**e
  lcm %= MOD

for x in set(a.tolist()):
  lcm *= x
  lcm %= MOD

answer = sum(pow(x, MOD-2, MOD) for x in B.tolist())%MOD
answer *= lcm
answer %= MOD
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
N = int(input())
a = [int(c) for c in input().split()]
mod = 10**9+7
ans = a[0]
b = 0
for i in range(1, N):
  ans = ans*a[i]//gcd(ans, a[i])
b = 0
for i in range(N):
  b += (ans//a[i])%mod
print(b%mod)

Fixed submission:
import numpy as np
N = int(input())
a = np.array(input().split(), np.int64)
MOD = 10**9+7
U = 10**6+10
is_prime = np.zeros(U, np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3, U, 2):
  if p*p>U:
    break
  if is_prime[p]==1:
    is_prime[p*p::p+p] = 0

M = 10**3
small_primes = np.where(is_prime[:M])[0].tolist()

B = a.copy()
lcm = 1
for p in small_primes:
  e = 0
  while np.any(a%p==0):
    a[a%p==0] //= p
    e += 1
  lcm *= p**e
  lcm %= MOD

for x in set(a.tolist()):
  lcm *= x
  lcm %= MOD

answer = sum(pow(x, MOD-2, MOD) for x in B.tolist())%MOD
answer *= lcm
answer %= MOD
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
N = int(input())
a = [int(c) for c in input().split()]
mod = 10**9+7
ans = a[0]
for i in range(1, N):
  ans = ans* a[i]//gcd(ans, a[i])
b = 0
for i in range(N):
  b += (ans//a[i])%mod
print(b%mod)

Fixed submission:
import numpy as np
N = int(input())
a = np.array(input().split(), np.int64)
MOD = 10**9+7
U = 10**6+10
is_prime = np.zeros(U, np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3, U, 2):
  if p*p>U:
    break
  if is_prime[p]==1:
    is_prime[p*p::p+p] = 0

M = 10**3
small_primes = np.where(is_prime[:M])[0].tolist()

B = a.copy()
lcm = 1
for p in small_primes:
  e = 0
  while np.any(a%p==0):
    a[a%p==0] //= p
    e += 1
  lcm *= p**e
  lcm %= MOD

for x in set(a.tolist()):
  lcm *= x
  lcm %= MOD

answer = sum(pow(x, MOD-2, MOD) for x in B.tolist())%MOD
answer *= lcm
answer %= MOD
print(answer)