Buggy python submission (verdict: Time Limit Exceeded):
def main():
  ans = 0
  n = int(input())
  a = tuple(map(int, input().split()))
  ov = 10**9+7
  from fractions import gcd
  def lcm(a):
      x = a[0]
      ln = len(a)
      for i in range(1, ln):
          x = (x * a[i]) // gcd(x, a[i])
      return x
  l = lcm(a)
  for i in range(n):
    ans += l//a[i]%ov
  print(ans%ov)
if __name__ == "__main__":
  main()



Fixed submission:
def main():
  from functools import reduce
  from fractions import gcd
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  ov = 10**9+7
  def lcm(x,y):
    return (x * y) // gcd(x, y)
  def lcm_list(a):
    return reduce(lcm, a, 1)
  l = lcm_list(b)
  for i in range(n):
    ans += l//b[i]
  print(ans%ov)
if __name__ == "__main__":
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  from functools import reduce
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  b_ = tuple(set(b))
  ov = 10**9+7
  from fractions import gcd
  def lcm(x,y):
    return (x * y) // gcd(x, y)
  def lcm_list(a):
    return reduce(lcm, a, 1)
  l = lcm_list(b_)
  for i in b:
    ans += l//i%ov
  print(ans%ov)
if __name__ == "__main__":
  main()


Fixed submission:
def main():
  from functools import reduce
  from fractions import gcd
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  ov = 10**9+7
  def lcm(x,y):
    return (x * y) // gcd(x, y)
  def lcm_list(a):
    return reduce(lcm, a, 1)
  l = lcm_list(b)
  for i in range(n):
    ans += l//b[i]
  print(ans%ov)
if __name__ == "__main__":
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  def prime_factorize(n):
    a = []
    while n % 2 == 0:
      a.append(2)
      n //= 2
    f = 3
    while f * f <= n:
      if n % f == 0:
        a.append(f)
        n //= f
      else:
        f += 2
    if n != 1:
      a.append(n)
    return a
  def prime_dict(a):
    import collections
    c = collections.Counter(prime_factorize(a))
    return c

  ans = 0
  n = int(input())
  a = tuple(map(int, input().split()))
  ov = 10**9+7
  c = {}
  for i in a:
    d = prime_dict(i)
    for k in d.keys():
      m = 0
      if k in c:
        if d[k] < c[k]:
          continue
      c[k] = d[k]
  lcm = 1
  for k,v in c.items():
    lcm *= k**v
  for i in a:
    ans += lcm//i%ov
  print(ans%ov)
if __name__ == "__main__":
  main()

Fixed submission:
def main():
  from functools import reduce
  from fractions import gcd
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  ov = 10**9+7
  def lcm(x,y):
    return (x * y) // gcd(x, y)
  def lcm_list(a):
    return reduce(lcm, a, 1)
  l = lcm_list(b)
  for i in range(n):
    ans += l//b[i]
  print(ans%ov)
if __name__ == "__main__":
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  def prime_factorize(n):
    a = []
    while n % 2 == 0:
      a.append(2)
      n //= 2
    f = 3
    while f * f <= n:
      if n % f == 0:
        a.append(f)
        n //= f
      else:
        f += 2
    if n != 1:
      a.append(n)
    return a
  def prime_dict(a):
    import collections
    c = collections.Counter(prime_factorize(a))
    return c

  ans = 0
  n = int(input())
  a = tuple(map(int, input().split()))
  ov = 10**9+7
  c = {}
  for i in a:
    d = prime_dict(i)
    for k in d.keys():
      m = 0
      if k in c:
        m = c[k]
      c[k] = max(d[k],m)
  lcm = 1
  for k,v in c.items():
    lcm *= k**v
  for i in a:
    ans += lcm//i%ov
  print(ans%ov)
if __name__ == "__main__":
  main()

Fixed submission:
def main():
  from functools import reduce
  from fractions import gcd
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  ov = 10**9+7
  def lcm(x,y):
    return (x * y) // gcd(x, y)
  def lcm_list(a):
    return reduce(lcm, a, 1)
  l = lcm_list(b)
  for i in range(n):
    ans += l//b[i]
  print(ans%ov)
if __name__ == "__main__":
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  b_ = tuple(set(b))
  ov = 10**9+7
  from fractions import gcd
  def lcm(a):
      x = a[0]
      ln = len(a)
      for i in range(1, ln):
          x = (x * a[i]) // gcd(x, a[i])
      return x
  l = lcm(b_)
  for i in b:
    ans += l//i%ov
  print(ans%ov)
if __name__ == "__main__":
  main()

Fixed submission:
def main():
  from functools import reduce
  from fractions import gcd
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  ov = 10**9+7
  def lcm(x,y):
    return (x * y) // gcd(x, y)
  def lcm_list(a):
    return reduce(lcm, a, 1)
  l = lcm_list(b)
  for i in range(n):
    ans += l//b[i]
  print(ans%ov)
if __name__ == "__main__":
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  ans = 0
  n = int(input())
  a = tuple(map(int, input().split()))
  a_ = tuple(set(a))
  ov = 10**9+7
  from fractions import gcd
  def lcm(a):
      x = a[0]
      ln = len(a)
      for i in range(1, ln):
          x = (x * a[i]) // gcd(x, a[i])
      return x
  l = lcm(a_)
  for i in a:
    ans += l//i%ov
  print(ans%ov)
if __name__ == "__main__":
  main()

Fixed submission:
def main():
  from functools import reduce
  from fractions import gcd
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  ov = 10**9+7
  def lcm(x,y):
    return (x * y) // gcd(x, y)
  def lcm_list(a):
    return reduce(lcm, a, 1)
  l = lcm_list(b)
  for i in range(n):
    ans += l//b[i]
  print(ans%ov)
if __name__ == "__main__":
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  ans = 0
  n = int(input())
  a = tuple(map(int, input().split()))
  ov = 10**9+7
  from fractions import gcd
  def lcm(a):
      x = a[0]
      for i in range(1, n):
          x = (x * a[i]) // gcd(x, a[i])
      return x
  l = lcm(a)
  for i in a:
    ans += l//i%ov
  print(ans%ov)
if __name__ == "__main__":
  main()

Fixed submission:
def main():
  from functools import reduce
  from fractions import gcd
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  ov = 10**9+7
  def lcm(x,y):
    return (x * y) // gcd(x, y)
  def lcm_list(a):
    return reduce(lcm, a, 1)
  l = lcm_list(b)
  for i in range(n):
    ans += l//b[i]
  print(ans%ov)
if __name__ == "__main__":
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  ans = 0
  n = int(input())
  a = tuple(map(int, input().split()))
  ov = 10**9+7
  from fractions import gcd
  def lcm(a):
      x = a[0]
      for i in range(1, n):
          x = (x * a[i]) // gcd(x, a[i])
      return x
  l = lcm(a)
  for i in a:
    ans += l//i%ov
  print(ans%ov)
if __name__ == "__main__":
  main()

Fixed submission:
def main():
  from functools import reduce
  from fractions import gcd
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  ov = 10**9+7
  def lcm(x,y):
    return (x * y) // gcd(x, y)
  def lcm_list(a):
    return reduce(lcm, a, 1)
  l = lcm_list(b)
  for i in range(n):
    ans += l//b[i]
  print(ans%ov)
if __name__ == "__main__":
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n = int(input())
  a = tuple(map(int, input().split()))
  ov = 10**9+7
  from fractions import gcd
  def lcm(a):
      x = a[0]
      for i in range(1, n):
          x = (x * a[i]) // gcd(x, a[i])
      return x
  l = lcm(a)
  b= [l//i%ov for i in a]
  print(sum(b)%ov)
if __name__ == "__main__":
  main()

Fixed submission:
def main():
  from functools import reduce
  from fractions import gcd
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  ov = 10**9+7
  def lcm(x,y):
    return (x * y) // gcd(x, y)
  def lcm_list(a):
    return reduce(lcm, a, 1)
  l = lcm_list(b)
  for i in range(n):
    ans += l//b[i]
  print(ans%ov)
if __name__ == "__main__":
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n = int(input())
  a = tuple(map(int, input().split()))
  ov = 10**9+7
  from fractions import gcd
  def lcm(a):
      x = a[0]
      for i in range(1, len(a)):
          x = (x * a[i]) // gcd(x, a[i])
      return x
  l = lcm(a)
  b= [l//i%ov for i in a]
  print(sum(b)%ov)
if __name__ == "__main__":
  main()

Fixed submission:
def main():
  from functools import reduce
  from fractions import gcd
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  ov = 10**9+7
  def lcm(x,y):
    return (x * y) // gcd(x, y)
  def lcm_list(a):
    return reduce(lcm, a, 1)
  l = lcm_list(b)
  for i in range(n):
    ans += l//b[i]
  print(ans%ov)
if __name__ == "__main__":
  main()

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


Fixed submission:
def main():
  from functools import reduce
  from fractions import gcd
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  ov = 10**9+7
  def lcm(x,y):
    return (x * y) // gcd(x, y)
  def lcm_list(a):
    return reduce(lcm, a, 1)
  l = lcm_list(b)
  for i in range(n):
    ans += l//b[i]
  print(ans%ov)
if __name__ == "__main__":
  main()

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

Fixed submission:
def main():
  from functools import reduce
  from fractions import gcd
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  ov = 10**9+7
  def lcm(x,y):
    return (x * y) // gcd(x, y)
  def lcm_list(a):
    return reduce(lcm, a, 1)
  l = lcm_list(b)
  for i in range(n):
    ans += l//b[i]
  print(ans%ov)
if __name__ == "__main__":
  main()

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

Fixed submission:
def main():
  from functools import reduce
  from fractions import gcd
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  ov = 10**9+7
  def lcm(x,y):
    return (x * y) // gcd(x, y)
  def lcm_list(a):
    return reduce(lcm, a, 1)
  l = lcm_list(b)
  for i in range(n):
    ans += l//b[i]
  print(ans%ov)
if __name__ == "__main__":
  main()