Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import fractions
    import sys
    input = sys.stdin.readline
    N = int(input())
    a = list(map(int,input().split()))
    MOD = 10**9+7
    g1 = 1
    for t in a[:N//2]:
        g1 = divmod(g1*t,fractions.gcd(g1,t))[0]

    g2 = 1
    for t in a[N//2:]:
        g2 = divmod(g2*t,fractions.gcd(g2,t))[0]
    res = 0
    g = fractions.gcd(g1,g2)

    r1 = (g2//g)%MOD
    for t in a[:N//2]:
        res += divmod(g1,t)[0]
    res = res*r1%MOD

    res2 = 0
    r2 = (g1//g)%MOD
    for t in a[N//2:]:
        res2 += divmod(g2,t)[0]
    res2 = res2*r2%MOD
    print((res+res2)%MOD)
if __name__ == '__main__':
    main()


Fixed submission:
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
res = 0
MOD = 10**9+7
for elem in a:
    tmp = g*elem//fractions.gcd(g,elem)
    res *= tmp//g
    g = tmp
    res += g//elem
print(res%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import sys
input = sys.stdin.readline
def lcm(X,Y):
    x=X
    y=Y
    if y>x:
        x,y=y,x
    while x%y!=0:
        x,y=y,x%y
    return X*Y//y
N = int(input())
a = tuple(map(int,input().split()))
g = 1
res = 0
MOD = 10**9+7
for elem in a:
    g = lcm(g,elem)
res = sum((g//elem for elem in a))
print(res%MOD)


Fixed submission:
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
res = 0
MOD = 10**9+7
for elem in a:
    tmp = g*elem//fractions.gcd(g,elem)
    res *= tmp//g
    g = tmp
    res += g//elem
print(res%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
MOD = 10**9+7
for elem in a:
    g *= elem//fractions.gcd(g,elem)
res = sum((g//elem for elem in a))
print(res%MOD)


Fixed submission:
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
res = 0
MOD = 10**9+7
for elem in a:
    tmp = g*elem//fractions.gcd(g,elem)
    res *= tmp//g
    g = tmp
    res += g//elem
print(res%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = tuple(map(int,input().split()))
g = 1
MOD = 10**9+7
for elem in a:
    g *= elem//fractions.gcd(g,elem)
res = 0
for elem in a:
    res += g//elem
print(res%MOD)


Fixed submission:
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
res = 0
MOD = 10**9+7
for elem in a:
    tmp = g*elem//fractions.gcd(g,elem)
    res *= tmp//g
    g = tmp
    res += g//elem
print(res%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
MOD = 10**9+7
for elem in a:
    g *= elem//fractions.gcd(g,elem)
res = sum([g//elem for elem in a])
print(res%MOD)


Fixed submission:
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
res = 0
MOD = 10**9+7
for elem in a:
    tmp = g*elem//fractions.gcd(g,elem)
    res *= tmp//g
    g = tmp
    res += g//elem
print(res%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
MOD = 10**9+7
for elem in a:
    g *= elem//fractions.gcd(g,elem)
res = 0
for elem in a:
    res += g//elem
print(res%MOD)


Fixed submission:
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
res = 0
MOD = 10**9+7
for elem in a:
    tmp = g*elem//fractions.gcd(g,elem)
    res *= tmp//g
    g = tmp
    res += g//elem
print(res%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import fractions
    import sys
    input = sys.stdin.readline
    N = int(input())
    a = list(map(int,input().split()))
    MOD = 10**9+7
    g1 = 1
    for t in a[:N//2]:
        g1 = divmod(g1*t,fractions.gcd(g1,t))[0]

    g2 = 1
    for t in a[N//2:]:
        g2 = divmod(g2*t,fractions.gcd(g2,t))[0]
    res = 0
    g = fractions.gcd(g1,g2)

    r1 = (g2//g)%MOD
    for t in a[:N//2]:
        res += divmod(g1,t)[0]%MOD
    res = res*r1%MOD

    res2 = 0
    r2 = (g1//g)%MOD
    for t in a[N//2:]:
        res2 += divmod(g2,t)[0]%MOD
    res2 = res2*r2%MOD
    print((res+res2)%MOD)
if __name__ == '__main__':
    main()


Fixed submission:
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
res = 0
MOD = 10**9+7
for elem in a:
    tmp = g*elem//fractions.gcd(g,elem)
    res *= tmp//g
    g = tmp
    res += g//elem
print(res%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import fractions
    import sys
    input = sys.stdin.readline
    N = int(input())
    a = tuple(map(int,input().split()))
    MOD = 10**9+7
    g1 = 1
    for t in a[:N//2]:
        g1 = divmod(g1*t,fractions.gcd(g1,t))[0]

    g2 = 1
    for t in a[N//2:]:
        g2 = divmod(g2*t,fractions.gcd(g2,t))[0]
    res = 0
    g = fractions.gcd(g1,g2)

    r1 = (g2//g)%MOD
    for t in a[:N//2]:
        res += divmod(g1,t)[0]%MOD
    res = res*r1%MOD

    res2 = 0
    r2 = (g1//g)%MOD
    for t in a[N//2:]:
        res2 += divmod(g2,t)[0]%MOD
    res2 = res2*r2%MOD
    print((res+res2)%MOD)
if __name__ == '__main__':
    main()


Fixed submission:
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
res = 0
MOD = 10**9+7
for elem in a:
    tmp = g*elem//fractions.gcd(g,elem)
    res *= tmp//g
    g = tmp
    res += g//elem
print(res%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import fractions
    import sys
    input = sys.stdin.readline
    N = int(input())
    a = tuple(map(int,input().split()))
    MOD = 10**9+7
    g1 = 1
    for i,t in enumerate(a[:N//2]):
        g1 = divmod(g1*t,fractions.gcd(g1,t))[0]

    g2 = 1
    for i,t in enumerate(a[N//2:]):
        g2 = divmod(g2*t,fractions.gcd(g2,t))[0]
    res = 0
    g = fractions.gcd(g1,g2)

    r1 = (g2//g)%MOD
    for t in a[:N//2]:
        res += r1*divmod(g1,t)[0]%MOD
    r2 = (g1//g)%MOD
    for t in a[N//2:]:
        res += r2*divmod(g2,t)[0]%MOD
    print(res%MOD)
if __name__ == '__main__':
    main()


Fixed submission:
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
res = 0
MOD = 10**9+7
for elem in a:
    tmp = g*elem//fractions.gcd(g,elem)
    res *= tmp//g
    g = tmp
    res += g//elem
print(res%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import fractions
    import sys
    input = sys.stdin.readline
    N = int(input())
    a = tuple(map(int,input().split()))
    g = a[0]
    MOD = 10**9+7
    for t in a:
        #g = g*a[i]//fractions.gcd(g,a[i])
        g = divmod(g*t,fractions.gcd(g,t))[0]
    res = 0
    for t in a:
        res += divmod(g,t)[0]%MOD
    print(res%MOD)
if __name__ == '__main__':
    main()


Fixed submission:
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
res = 0
MOD = 10**9+7
for elem in a:
    tmp = g*elem//fractions.gcd(g,elem)
    res *= tmp//g
    g = tmp
    res += g//elem
print(res%MOD)

Buggy python submission (verdict: Runtime Error):
def main():
    import fractions
    import sys
    input = sys.stdin.readline
    N = int(input())
    a = tuple(map(int,input().split()))
    g = a[0]
    MOD = 10**9+7
    for i in range(1,N):
        t = a[i]
        #g = g*a[i]//fractions.gcd(g,a[i])
        g = divmod(g*t,fractions.gcd(g,t))[0]
    assert()
    res = 0
    for i in range(N):
        res += divmod(g,a[i])[1]
        res += (g//a[i])%MOD
    print(res%MOD)
if __name__ == '__main__':
    main()


Fixed submission:
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
res = 0
MOD = 10**9+7
for elem in a:
    tmp = g*elem//fractions.gcd(g,elem)
    res *= tmp//g
    g = tmp
    res += g//elem
print(res%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import fractions
    import sys
    input = sys.stdin.readline
    N = int(input())
    a = tuple(map(int,input().split()))
    g = a[0]
    MOD = 10**9+7
    for i in range(1,N):
        t = a[i]
        #g = g*a[i]//fractions.gcd(g,a[i])
        g = divmod(g*t,fractions.gcd(g,t))[0]
    res = 0
    for i in range(N):
        res += (g//a[i])%MOD
    print(res%MOD)
if __name__ == '__main__':
    main()


Fixed submission:
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
res = 0
MOD = 10**9+7
for elem in a:
    tmp = g*elem//fractions.gcd(g,elem)
    res *= tmp//g
    g = tmp
    res += g//elem
print(res%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = tuple(map(int,input().split()))
g = 1
MOD = 10**9+7
for i in range(N):
    g = g*a[i]//fractions.gcd(g,a[i])
res = 0
for i in range(N):
    res += (g//a[i])%MOD
print(res%MOD)


Fixed submission:
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
res = 0
MOD = 10**9+7
for elem in a:
    tmp = g*elem//fractions.gcd(g,elem)
    res *= tmp//g
    g = tmp
    res += g//elem
print(res%MOD)

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


Fixed submission:
import fractions
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int,input().split()))
g = 1
res = 0
MOD = 10**9+7
for elem in a:
    tmp = g*elem//fractions.gcd(g,elem)
    res *= tmp//g
    g = tmp
    res += g//elem
print(res%MOD)