Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd  # python<=3.4

MOD=1000000007

n = int(input().rstrip())
a = [int(x) for x in input().rstrip().split()]

el = 1
for ai in a:
  g = gcd(el,ai)
  el = el // g * ai

sum = 0
for ai in a:
  sum += el // ai

sum %= MOD
print(sum)


Fixed submission:
from fractions import gcd  # python<=3.4

MOD=1000000007

def ADD(x, y):
  return (x + y) % MOD

def SUB(x, y):
  return (x - y + MOD) % MOD

def MUL(x, y):
  return x * y % MOD

def POW(x, e):
  v = 1
  while e:
    if e & 1:
      v = MUL(v, x)
    x = MUL(x, x)
    e >>= 1
  return v

def INV(x):
  return POW(x, MOD-2)

def DIV(x, y):
  return MUL(x, INV(y))


n = int(input().rstrip())
a = [int(x) for x in input().rstrip().split()]

el = 1
for ai in a:
  g = gcd(el,ai)
  el = el // g * ai

el %= MOD

sum = 0
for ai in a:
  sum += DIV(el, ai)

sum %= MOD
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd  # python<=3.4

MOD=1000000007

n = int(input().rstrip())
a = [int(x) for x in input().rstrip().split()]

el = 1
for ai in a:
  g = gcd(el,ai)
  el = el // g * ai

sum = 0
for ai in a:
    sum = (sum + el // ai) % MOD

print(sum)


Fixed submission:
from fractions import gcd  # python<=3.4

MOD=1000000007

def ADD(x, y):
  return (x + y) % MOD

def SUB(x, y):
  return (x - y + MOD) % MOD

def MUL(x, y):
  return x * y % MOD

def POW(x, e):
  v = 1
  while e:
    if e & 1:
      v = MUL(v, x)
    x = MUL(x, x)
    e >>= 1
  return v

def INV(x):
  return POW(x, MOD-2)

def DIV(x, y):
  return MUL(x, INV(y))


n = int(input().rstrip())
a = [int(x) for x in input().rstrip().split()]

el = 1
for ai in a:
  g = gcd(el,ai)
  el = el // g * ai

el %= MOD

sum = 0
for ai in a:
  sum += DIV(el, ai)

sum %= MOD
print(sum)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd  # python<=3.4

MOD=1000000007

n = int(input().rstrip())
a = [int(x) for x in input().rstrip().split()]

el = 1
for ai in a:
  g = gcd(a,b)
  el = el // g * b

sum = 0
for ai in a:
    sum = (sum + el // ai) % MOD

print(sum)


Fixed submission:
from fractions import gcd  # python<=3.4

MOD=1000000007

def ADD(x, y):
  return (x + y) % MOD

def SUB(x, y):
  return (x - y + MOD) % MOD

def MUL(x, y):
  return x * y % MOD

def POW(x, e):
  v = 1
  while e:
    if e & 1:
      v = MUL(v, x)
    x = MUL(x, x)
    e >>= 1
  return v

def INV(x):
  return POW(x, MOD-2)

def DIV(x, y):
  return MUL(x, INV(y))


n = int(input().rstrip())
a = [int(x) for x in input().rstrip().split()]

el = 1
for ai in a:
  g = gcd(el,ai)
  el = el // g * ai

el %= MOD

sum = 0
for ai in a:
  sum += DIV(el, ai)

sum %= MOD
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- encoding: utf-8 -*-
import sys
from math import sqrt,log
from fractions import gcd  # python<=3.4

MOD=1000000007

def lcm(a,b):
  return a // gcd(a,b) * b


n = int(input().rstrip())
a = list(map(int, input().rstrip().split()))
# print(n,a)

el = 1
for ai in a:
    el = lcm(el, ai)

# print("el=", el)

sum = 0
for ai in a:
    bi = el // ai
    # print(bi, end=" ")
    sum += bi
    sum %= MOD
# print()
print(sum)


Fixed submission:
from fractions import gcd  # python<=3.4

MOD=1000000007

def ADD(x, y):
  return (x + y) % MOD

def SUB(x, y):
  return (x - y + MOD) % MOD

def MUL(x, y):
  return x * y % MOD

def POW(x, e):
  v = 1
  while e:
    if e & 1:
      v = MUL(v, x)
    x = MUL(x, x)
    e >>= 1
  return v

def INV(x):
  return POW(x, MOD-2)

def DIV(x, y):
  return MUL(x, INV(y))


n = int(input().rstrip())
a = [int(x) for x in input().rstrip().split()]

el = 1
for ai in a:
  g = gcd(el,ai)
  el = el // g * ai

el %= MOD

sum = 0
for ai in a:
  sum += DIV(el, ai)

sum %= MOD
print(sum)