Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce

def lcm_base(x, y):
  return (x*y) // fractions.gcd(x,y)
def lcm_list(numbers):
  return reduce(lcm_base,numbers,1)

N=int(input())
alist=list(map(int,input().split()))

if N==1:
  print(1)
else:
  alist.sort()
  lcm_alist=lcm_list(alist)
  
  answer=0
  last_a=-1
  last_b=-1
  for a in alist:
    b=last_b
    if a!=last_a:
      b=lcm_alist//a
      last_a=a
      last_b=b

    answer=(answer+b)%(10**9+7)
    
  #print(blist)
  print(answer)

Fixed submission:
import fractions
import sys
from functools import reduce

def lcm_base(x, y):
  return (x*y) // fractions.gcd(x, y)
def lcm_list(numbers):
  return reduce(lcm_base, numbers, 1)

N=int(input())
alist=list(map(int,input().split()))

if N==1:
  print(1)
else:
  lcm_alist=lcm_list(alist)
  #print(lcm_alist)
  
  allsum=0
  for i in range(N):
    allsum+=lcm_alist//alist[i]
    
  #print(blist)
  print(allsum%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce

def lcm_base(x, y):
  return (x*y) // fractions.gcd(x,y)
def lcm_list(numbers):
  return reduce(lcm_base,numbers,1)

N=int(input())
alist=list(map(int,input().split()))

if N==1:
  print(1)
else:
  alist.sort()
  lcm_alist=lcm_list(alist)
  
  answer=0
  last_a=-1
  last_b=-1
  for a in alist:
    b=last_b
    if a!=last_a:
      b=lcm_alist//a
      last_a=a
      last_b=b

    answer=(answer+b)%(10**9+7)
    
  #print(blist)
  print(answer)

Fixed submission:
import fractions
import sys
from functools import reduce

def lcm_base(x, y):
  return (x*y) // fractions.gcd(x, y)
def lcm_list(numbers):
  return reduce(lcm_base, numbers, 1)

N=int(input())
alist=list(map(int,input().split()))

if N==1:
  print(1)
else:
  lcm_alist=lcm_list(alist)
  #print(lcm_alist)
  
  allsum=0
  for i in range(N):
    allsum+=lcm_alist//alist[i]
    
  #print(blist)
  print(allsum%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce

def lcm_base(x, y):
  return (x*y) // fractions.gcd(x,y)
def lcm_list(numbers):
  return reduce(lcm_base,numbers,1)

N=int(input())
alist=list(map(int,input().split()))

if N==1:
  print(1)
else:
  alist.sort()
  lcm_alist=lcm_list(alist)
  
  answer=0
  last_a=-1
  last_b=-1
  for a in alist:
    b=last_b
    if a!=last_a:
      b=lcm_alist//a
      last_b=b

    answer=(answer+b)%(10**9+7)
    
  #print(blist)
  print(answer)

Fixed submission:
import fractions
import sys
from functools import reduce

def lcm_base(x, y):
  return (x*y) // fractions.gcd(x, y)
def lcm_list(numbers):
  return reduce(lcm_base, numbers, 1)

N=int(input())
alist=list(map(int,input().split()))

if N==1:
  print(1)
else:
  lcm_alist=lcm_list(alist)
  #print(lcm_alist)
  
  allsum=0
  for i in range(N):
    allsum+=lcm_alist//alist[i]
    
  #print(blist)
  print(allsum%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce

def lcm_base(x, y):
  return (x*y) // fractions.gcd(x,y)
def lcm_list(numbers):
  return reduce(lcm_base,numbers,1)

N=int(input())
alist=list(map(int,input().split()))

if N==1:
  print(1)
else:
  alist.sort()
  lcm_alist=lcm_list(alist)
  
  answer=0
  last_a=-1
  last_b=-1
  for a in alist:
    b=last_b
    if a!=last_a:
      b=lcm_alist//a
      last_b=b

    answer=(answer+b)%(10**9+7)
    
  #print(blist)
  print(answer)

Fixed submission:
import fractions
import sys
from functools import reduce

def lcm_base(x, y):
  return (x*y) // fractions.gcd(x, y)
def lcm_list(numbers):
  return reduce(lcm_base, numbers, 1)

N=int(input())
alist=list(map(int,input().split()))

if N==1:
  print(1)
else:
  lcm_alist=lcm_list(alist)
  #print(lcm_alist)
  
  allsum=0
  for i in range(N):
    allsum+=lcm_alist//alist[i]
    
  #print(blist)
  print(allsum%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import sys
from functools import reduce

def lcm_base(x, y):
  return (x*y) // fractions.gcd(x, y)
def lcm_list(numbers):
  return reduce(lcm_base, numbers, 1)

N=int(input())
alist=list(map(int,input().split()))

if N==1:
  print(1)
else:
  lcm_alist=lcm_list(alist)
  #print(lcm_alist)
  
  blist=[]
  for i in range(N):
    blist.append(lcm_alist//alist[i])
    
  #print(blist)
  print(sum(blist)%(10**9+7))

Fixed submission:
import fractions
import sys
from functools import reduce

def lcm_base(x, y):
  return (x*y) // fractions.gcd(x, y)
def lcm_list(numbers):
  return reduce(lcm_base, numbers, 1)

N=int(input())
alist=list(map(int,input().split()))

if N==1:
  print(1)
else:
  lcm_alist=lcm_list(alist)
  #print(lcm_alist)
  
  allsum=0
  for i in range(N):
    allsum+=lcm_alist//alist[i]
    
  #print(blist)
  print(allsum%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import sys
from functools import reduce

def lcm_base(x, y):
  return (x*y) // fractions.gcd(x, y)
def lcm_list(numbers):
  return reduce(lcm_base, numbers, 1)

N=int(input())
alist=list(map(int,input().split()))

if N==1:
  print(1)
else:
  lcm_alist=lcm_list(alist)
  #print(lcm_alist)
  
  blist=[]
  for i in range(N):
    blist.append(lcm_alist//alist[i])
    
  #print(blist)
  print(sum(blist)%(10**9+7))

Fixed submission:
import fractions
import sys
from functools import reduce

def lcm_base(x, y):
  return (x*y) // fractions.gcd(x, y)
def lcm_list(numbers):
  return reduce(lcm_base, numbers, 1)

N=int(input())
alist=list(map(int,input().split()))

if N==1:
  print(1)
else:
  lcm_alist=lcm_list(alist)
  #print(lcm_alist)
  
  allsum=0
  for i in range(N):
    allsum+=lcm_alist//alist[i]
    
  #print(blist)
  print(allsum%(10**9+7))