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

Fixed submission:
from fractions import *
n,*a=map(int,open(0).read().split())
b=1
for i in a:b*=i//gcd(b,i)
print(sum(b//i for i in a)%(10**9+7))

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

Fixed submission:
from fractions import *
n,*a=map(int,open(0).read().split())
b=1
for i in a:b*=i//gcd(b,i)
print(sum(b//i for i in a)%(10**9+7))

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


Fixed submission:
from fractions import *
n,*a=map(int,open(0).read().split())
b=1
for i in a:b*=i//gcd(b,i)
print(sum(b//i for i in a)%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    from fractions import gcd
    import sys
    input = sys.stdin.readline
    n=int(input())
    a=list(map(int,input().split()))
    # n,*a=map(int,open(0).read().split())
    mod=10**9+7
    a.sort()
    b=a[-1]
    for i in a:
        if b%i!=0:
            b=b*i//gcd(b,i)
    ans=0
    print(sum(b//i%mod for i in a)%mod)    
if __name__ == '__main__':
    main()

Fixed submission:
from fractions import *
n,*a=map(int,open(0).read().split())
b=1
for i in a:b*=i//gcd(b,i)
print(sum(b//i for i in a)%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    from fractions import gcd
    import sys
    input = sys.stdin.readline
    n=int(input())
    a=list(map(int,input().split()))
    # n,*a=map(int,open(0).read().split())
    mod=10**9+7
    b=max(a)
    for i in a:
        if b%i!=0:
            b=b*i//gcd(b,i)
    ans=0
    for i in a:
        ans+=b//i
        ans%=mod
    print(ans)    
    # print(sum(b//i%mod for i in a)%mod)    
if __name__ == '__main__':
    main()

Fixed submission:
from fractions import *
n,*a=map(int,open(0).read().split())
b=1
for i in a:b*=i//gcd(b,i)
print(sum(b//i for i in a)%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    from fractions import gcd
    import sys
    input = sys.stdin.readline
    n=int(input())
    a=list(map(int,input().split()))
    # n,*a=map(int,open(0).read().split())
    mod=10**9+7
    b=a[0]
    for i in a:
        if b%i!=0:
            b=b*i//gcd(b,i)
    ans=0
    for i in a:
        ans+=b//i
        ans%=mod
    print(ans)    
    # print(sum(b//i%mod for i in a)%mod)    
if __name__ == '__main__':
    main()

Fixed submission:
from fractions import *
n,*a=map(int,open(0).read().split())
b=1
for i in a:b*=i//gcd(b,i)
print(sum(b//i for i in a)%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    from fractions import gcd
    import sys
    input = sys.stdin.readline
    n=int(input())
    a=list(map(int,input().split()))
    # n,*a=map(int,open(0).read().split())
    mod=10**9+7
    b=a[0]
    for i in a:
        if b%i!=0:
            b=b*i//gcd(b,i)
    ans=0
    for i in a:
        ans+=b//i
        ans%=mod
    print(ans)    
    # print(sum(b//i%mod for i in a)%mod)    
if __name__ == '__main__':
    main()

Fixed submission:
from fractions import *
n,*a=map(int,open(0).read().split())
b=1
for i in a:b*=i//gcd(b,i)
print(sum(b//i for i in a)%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    from fractions import gcd
    import sys
    input = sys.stdin.readline
    n=int(input())
    a=list(map(int,input().split()))
    # n,*a=map(int,open(0).read().split())
    mod=10**9+7
    b=a[0]
    for i in a:
        b=b*i//gcd(b,i)
    ans=0
    for i in a:
        ans+=b//i
        ans%=mod
    print(ans)    
    # print(sum(b//i%mod for i in a)%mod)    
if __name__ == '__main__':
    main()

Fixed submission:
from fractions import *
n,*a=map(int,open(0).read().split())
b=1
for i in a:b*=i//gcd(b,i)
print(sum(b//i for i in a)%(10**9+7))

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

Fixed submission:
from fractions import *
n,*a=map(int,open(0).read().split())
b=1
for i in a:b*=i//gcd(b,i)
print(sum(b//i for i in a)%(10**9+7))

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

Fixed submission:
from fractions import *
n,*a=map(int,open(0).read().split())
b=1
for i in a:b*=i//gcd(b,i)
print(sum(b//i for i in a)%(10**9+7))