Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
def main():
    N=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    b=0
    c=1
    for a in A:
        c=c*a//gcd(c,a)
    for a in A:
        b+=(c//a)
        b%=mod
    print(b)
if __name__=="__main__":
    main()

Fixed submission:
from fractions import gcd
def main():
    N=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    b=0
    c=1
    for a in A:
        c=c*a//gcd(c,a)
    c%=mod
    for a in A:
        b+=c*pow(a,mod-2,mod)
    print(b%mod)
if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
def main():
    N=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    b=0
    c=1
    for a in A:
        c=c*a//gcd(c,a)
    for a in A:
        b+=(c//a)
        b%=mod
    print(b)
if __name__=="__main__":
    main()

Fixed submission:
from fractions import gcd
def main():
    N=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    b=0
    c=1
    for a in A:
        c=c*a//gcd(c,a)
    c%=mod
    for a in A:
        b+=c*pow(a,mod-2,mod)
    print(b%mod)
if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
def main():
    N=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    c=A[0]
    for a in A:
        c=c*a//gcd(c,a)
    b=0
    for a in A:
        b+=c//a
        b%=mod
    print(b)
main()

Fixed submission:
from fractions import gcd
def main():
    N=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    b=0
    c=1
    for a in A:
        c=c*a//gcd(c,a)
    c%=mod
    for a in A:
        b+=c*pow(a,mod-2,mod)
    print(b%mod)
if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
def main():
    N=int(input())
    a=list(map(int,input().split()))
    mod=10**9+7
    c=a[0]
    for i in range(1, N):
        c=c*a[i]//fractions.gcd(c,a[i])
    b=0
    for k in a:
        b+=c//k
        b%=mod
    print(b)
main()

Fixed submission:
from fractions import gcd
def main():
    N=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    b=0
    c=1
    for a in A:
        c=c*a//gcd(c,a)
    c%=mod
    for a in A:
        b+=c*pow(a,mod-2,mod)
    print(b%mod)
if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
N=int(input())
a=list(map(int,input().split()))
mod=10**9+7
c=a[0]
for i in range(1, N):
    c=c*a[i]//fractions.gcd(c,a[i])
b=0
for k in a:
    b+=c//k
    b%=mod
print(b)

Fixed submission:
from fractions import gcd
def main():
    N=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    b=0
    c=1
    for a in A:
        c=c*a//gcd(c,a)
    c%=mod
    for a in A:
        b+=c*pow(a,mod-2,mod)
    print(b%mod)
if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
N=int(input())
a=list(map(int,input().split()))
mod=10**9+7
c=a[0]
for i in range(1, N):
    c=c*a[i]//fractions.gcd(c,a[i])
b=0
for k in a:
    b+=c//k
    b%=mod
print(b)

Fixed submission:
from fractions import gcd
def main():
    N=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    b=0
    c=1
    for a in A:
        c=c*a//gcd(c,a)
    c%=mod
    for a in A:
        b+=c*pow(a,mod-2,mod)
    print(b%mod)
if __name__=="__main__":
    main()