Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.buffer.readline
n = int(input())
a = list(map(int, input().split()))
from fractions import gcd
def lcm(x,y):
  return (x*y)//gcd(x,y)
l = 1
mod = 10**9+7
for i in range(n):
  l = lcm(l, a[i])
ans = 0
for i in range(n):
  ans += l // a[i]
  ans %= mod
print(ans)


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

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.buffer.readline
n = int(input())
a = list(map(int, input().split()))
from fractions import gcd
from functools import reduce
def lcm(x,y):
  return (x*y)//gcd(x,y)
l = reduce(lcm, a)
mod = 10**9+7
ans = 0
for i in range(n):
  ans += l // a[i]
  ans %= mod
print(ans)

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

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

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
from functools import reduce
#import numpy as np
def f(x):
  rtn = {}
  i = 2
  while x > 1:
    if x % i == 0:
      x //= i
      if i in rtn:
        rtn[i] += 1
      else:
        rtn[i] = 1
    else:
      i += 1
  return rtn

def lcm(xs,ys):
  rtn = {}
  for i in xs:
    if i in ys:
      rtn[i] = max(xs[i], ys[i])
    else:
      rtn[i] = xs[i]
  for i in ys:
    if not i in rtn:
      rtn[i] = ys[i]
  return rtn
    
a = list(map(lambda x:f(int(x)), input().split()))
l = reduce(lcm, a)
ans = 0
mod = 10**9 + 7
for j in range(n):
  b = 1
  for i in l:
    if i in a[j]:
      b *= i ** (l[i] - a[j][i])
    else:
      b *= i ** l[i]
  ans += b
  ans %= mod
print(ans)

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
from fractions import gcd
from functools import reduce
import numpy as np
def lcm(x,y):
  return (x*y)//gcd(x,y)
l = reduce(lcm, a)
mod = 10**9+7
print(sum(l//(np.array(a)))%mod)

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