Buggy python submission (verdict: Time Limit Exceeded):
import sys
import fractions
import math
input = sys.stdin.readline

N = int(input())

#a, b, c = (int(i) for i in input().split())  
a = [int(i) for i in input().split()] 
#e = [[int(i) for i in input().split()] for i in range(n)] 

ans = a[0]
total = 0
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])

for j in range(N):
    total += ans//a[j]
    total %= (10**9+7)

print(int(total%(10**9+7)))


Fixed submission:
import sys
import fractions
input = sys.stdin.readline


def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x
 
def lcm(x, y):
    return x//fractions.gcd(x, y)*y
 
n = int(input())
a = list(map(int, input().split()))
 
l = 1
for x in a:
    l = lcm(x, l)
 
ans = 0
for x in a:
    ans += l//x
 
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import fractions
input = sys.stdin.readline



def main():
    N = int(input())
    a = [int(i) for i in input().split()] 
    M = 10**9+7
    ans = a[0]
    total = 0
    for i in range(1, N):
        ans = ans * a[i] // fractions.gcd(ans, a[i])

    for j in range(N):
        total += ans//a[j]
        total %= (10**9+7)

    print(int(total))

if __name__ == '__main__':
    main()


Fixed submission:
import sys
import fractions
input = sys.stdin.readline


def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x
 
def lcm(x, y):
    return x//fractions.gcd(x, y)*y
 
n = int(input())
a = list(map(int, input().split()))
 
l = 1
for x in a:
    l = lcm(x, l)
 
ans = 0
for x in a:
    ans += l//x
 
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x

def lcm(x, y):
    return x//gcd(x, y)*y

n = int(input())
a = list(map(int, input().split()))

l = 1
for x in a:
    l = lcm(x, l)

ans = 0
for x in a:
    ans += l//x

print(ans%(10**9+7))


Fixed submission:
import sys
import fractions
input = sys.stdin.readline


def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x
 
def lcm(x, y):
    return x//fractions.gcd(x, y)*y
 
n = int(input())
a = list(map(int, input().split()))
 
l = 1
for x in a:
    l = lcm(x, l)
 
ans = 0
for x in a:
    ans += l//x
 
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import fractions
input = sys.stdin.readline


def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x
 
def lcm(x, y):
    return x//fractions.gcd(x, y)*y
 
n = int(input())
a = list(map(int, input().split()))
 
l = 1
for x in a:
    l = lcm(x, l)
 
ans = 0
for x in a:
    ans += l//x
 
print(ans%(10**9+7))


Fixed submission:
import sys
import fractions
input = sys.stdin.readline


def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x
 
def lcm(x, y):
    return x//fractions.gcd(x, y)*y
 
n = int(input())
a = list(map(int, input().split()))
 
l = 1
for x in a:
    l = lcm(x, l)
 
ans = 0
for x in a:
    ans += l//x
 
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import fractions
input = sys.stdin.readline



def main():
    N = int(input())
    a = [int(i) for i in input().split()] 
    M = 10**9+7
    ans = a[0]
    total = 0
    for i in range(1, N):
        ans = ans * a[i] // fractions.gcd(ans, a[i])

    for j in range(N):
        total += ans//a[j]
        total %= M

    print(int(total))

if __name__ == '__main__':
    main()


Fixed submission:
import sys
import fractions
input = sys.stdin.readline


def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x
 
def lcm(x, y):
    return x//fractions.gcd(x, y)*y
 
n = int(input())
a = list(map(int, input().split()))
 
l = 1
for x in a:
    l = lcm(x, l)
 
ans = 0
for x in a:
    ans += l//x
 
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import fractions
input = sys.stdin.readline



def main():
    N = int(input())
    a = [int(i) for i in input().split()] 
    M = 10**9+7
    ans = a[0]
    total = 0
    for i in range(1, N):
        ans = ans * a[i] // fractions.gcd(ans, a[i])

    for j in range(N):
        total += ans//a[j]
        total %= M

    print(int(total))

if __name__ == '__main__':
    main()


Fixed submission:
import sys
import fractions
input = sys.stdin.readline


def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x
 
def lcm(x, y):
    return x//fractions.gcd(x, y)*y
 
n = int(input())
a = list(map(int, input().split()))
 
l = 1
for x in a:
    l = lcm(x, l)
 
ans = 0
for x in a:
    ans += l//x
 
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import fractions
import math
input = sys.stdin.readline

N = int(input())

#a, b, c = (int(i) for i in input().split())  
a = [int(i) for i in input().split()] 
#e = [[int(i) for i in input().split()] for i in range(n)] 

ans = a[0]
total = 0
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])

for j in range(N):
    total += ans//a[j]
    total %= (10**9+7)

print(int(total%(10**9+7)))


Fixed submission:
import sys
import fractions
input = sys.stdin.readline


def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x
 
def lcm(x, y):
    return x//fractions.gcd(x, y)*y
 
n = int(input())
a = list(map(int, input().split()))
 
l = 1
for x in a:
    l = lcm(x, l)
 
ans = 0
for x in a:
    ans += l//x
 
print(ans%(10**9+7))

Buggy python submission (verdict: Runtime Error):
import sys
import fractions
import math
input = sys.stdin.readline

N = int(input())

#a, b, c = (int(i) for i in input().split())  
a = [int(i) for i in input().split()] 
#e = [[int(i) for i in input().split()] for i in range(n)] 

ans = a[0]
total = 0
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])

for j in range(N):
    total += ans/a[j]

print(int(total%(10**9+7)))


Fixed submission:
import sys
import fractions
input = sys.stdin.readline


def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x
 
def lcm(x, y):
    return x//fractions.gcd(x, y)*y
 
n = int(input())
a = list(map(int, input().split()))
 
l = 1
for x in a:
    l = lcm(x, l)
 
ans = 0
for x in a:
    ans += l//x
 
print(ans%(10**9+7))