Buggy python submission (verdict: Time Limit Exceeded):
from fractions import*
_,a=open(0)
a=list(map(int,a.split()))
s=1
for i in a:s*=i//gcd(s,i)
print(sum(s//i for i in a)%(10**9+7))

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import*
l=lambda x,y:x//gcd(x,y)*y
n,*a=map(int,open(0).read().split())
s=1
for i in a:s=l(s,i)
print(sum(s//i for i in a)%(10**9+7))

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Runtime Error):
from fractions import*
l=lambda x,y=x//gcd(x,y)*y
n,*a=map(int,open(0).read().split())
s=1
for i in a:s=l(s,i)
print(sum(s//i for i in a)%(10**9+7))

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import*
n,*a=map(int,open(0).read().split())
r=range(n)
s=1
for i in r:s*=a[i]//gcd(s,a[i])
print(sum(s//a[i]for i in r)%(10**9+7))

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
g=lambda x,y:x if y<1else g(y,x%y)
_,a=open(0)
*a,=map(int,a.split())
s=1
for t in a:s*=t//g(s,t)
print(sum(s//i for i in a)%(10**9+7))

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import*
_,a=open(0)
*a,=map(int,a.split())
s=1
for t in a:s*=t//gcd(s,t)
c=0
for i in a:c+=s//i
print(c%(10**9+7))

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import*
_,a=open(0)
*a,=map(int,a.split())
s=1
for t in a:s*=t//gcd(s,t)
print(sum(s//i for i in a)%(10**9+7))

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import*
def main():
    _,a=open(0)
    *a,=map(int,a.split())
    s=1
    for i in a:s*=i//gcd(s,i)
    c=0
    for i in a:
        c+=s//i
        c%=10**9+7
    print(c)
main()

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=1
for t in a:s*=t//gcd(s,t)
c=0
for i in a:
    c+=s//i
    if c>M:c%=M
print(c)

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
_,a=open(0)
*a,=map(int,a.split())
s=1
for t in a:s*=t//gcd(s,t)
c=0
for i in a:
    c+=s//i
    c%=10**9+7
print(c)

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from time import time
from fractions import gcd
start=time()
M=10**9+7
lcm=lambda x,y:x//gcd(x,y)*y
n,*a=map(int,open(0).read().split())
if n==1:
    print(1)
    exit()
s=a[0]
for t in a[1:]:
    s=lcm(s,t)
    if time()-start>.6:
        break
c=0
for i in a:
    c+=s//i
    c%=M
print(c)

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from time import time
from fractions import gcd
start=time()
M=10**9+7
lcm=lambda x,y:x//gcd(x,y)*y
n,*a=map(int,open(0).read().split())
if n==1:
    print(1)
    exit()
s=a[0]
for t in a[1:]:
    s=lcm(s,t)
    if time()-start>.6:
        break
c=0
for i in a:
    c+=s//i
    c%=M
print(c)

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from time import time
from fractions import gcd
start=time()
M=10**9+7
lcm=lambda x,y:x//gcd(x,y)*y
n,*a=map(int,open(0).read().split())
if n==1:
    print(1)
    exit()
s=a[0]
for t in a[1:]:
    s=lcm(s,t)
    if time()-start>.6:
        s=lcm(s,max(a))
        break
c=0
for i in a:
    c+=s//i
    c%=M
print(c)

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from time import*
from fractions import*
start=time()
M=10**9+7
lcm=lambda x,y:x//gcd(x,y)*y
n,*a=map(int,open(0).read().split())
if n==1:
    print(1)
    exit()
s=a[0]
for t in a[1:]:
    s=lcm(s,t)
    if time()-start>.7:
        s=max(a)
        break
c=0
for i in a:
    c+=s//i
    c%=M
print(c)

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from time import*
from fractions import*
start=time()
M=10**9+7
lcm=lambda x,y:x//gcd(x,y)*y
n,*a=map(int,open(0).read().split())
if n==1:
    print(1)
    exit()
s=a[0]
for t in a[1:]:
    if time()-start>.7:
        s=max(a)
        break
    else:
        s=lcm(s,t)
c=0
for i in a:
    c+=s//i
    c%=M
print(c)

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from time import*
from fractions import*
start=time()
M=10**9+7
lcm=lambda x,y:x//gcd(x,y)*y
n,*a=map(int,open(0).read().split())
if n==1:
    print(1)
    exit()
s=a[0]
for t in a[1:]:
    if time()-start>1:
        s=max(a)
        break
    else:
        s=lcm(s,t)
c=0
for i in a:
    c+=s//i
    c%=M
print(c)

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from time import*
from fractions import*
start=time()
M=10**9+7
lcm=lambda x,y:x//gcd(x,y)*y
n,*a=map(int,open(0).read().split())
if n==1:
    print(1)
    exit()
s=a[0]
for t in a[1:]:
    if time()-start>1:
        s*=t
    else:
        s=lcm(s,t)
c=0
for i in a:
    c+=s//i
    c%=M
print(c)

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Runtime Error):
from numpy import*
M=10**9+7
_,a=open(0)
a=int64(a.split())
print(sum(lcm.reduce(a)//a)%M)

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import*
from functools import*
M=10**9+7
lcm=lambda x,y:x//gcd(x,y)*y
n,*a=map(int,open(0).read().split())
t=reduce(lcm,a)
c=0
for i in a:
    c+=t//i
    c%=M
print(c)

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import*
from functools import*
lcm=lambda x,y:x*y//gcd(x,y)
n,*a=map(int,open(0).read().split())
t=reduce(lcm,a)
c=0
M=10**9+7
for i in a:
    c+=t//i
    c%=M
print(c)

Fixed submission:
from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)