Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a

def lcm(a, b):
    return (a * b) // gcd(a, b)

readline = stdin.readline
num = int(readline())
d = list(map(int, readline().split()))
k = 1
MOD = 1000000007
ans = 0
for a in d:
    k = lcm(k, a)
for a in d:
    ans += k // a % MOD
print(ans % MOD)

Fixed submission:
from sys import stdin

def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a

def lcm(a, b):
    return (a * b) // gcd(a, b)

readline = stdin.readline
num = int(readline())
d = list(map(int, readline().split()))
k = 1
MOD = 1000000007
ans = 0
for a in d:
    k = lcm(k, a)
for a in d:
    ans += k // a
print(ans % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a

def lcm(a, b):
    return (a * b) // gcd(a, b)

readline = stdin.readline
num = int(readline())
d = list(map(int, readline().split()))
k = d[0]
MOD = 1000000007
ans = 0
for i in range(1, num):
    k = lcm(k, d[i])
for i in range(num):
    ans += k // d[i] % MOD
print(ans % MOD)

Fixed submission:
from sys import stdin

def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a

def lcm(a, b):
    return (a * b) // gcd(a, b)

readline = stdin.readline
num = int(readline())
d = list(map(int, readline().split()))
k = 1
MOD = 1000000007
ans = 0
for a in d:
    k = lcm(k, a)
for a in d:
    ans += k // a
print(ans % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from sys import stdin

def lcm(a, b):
    return (a * b) // gcd(a, b)

readline = stdin.readline
num = int(readline())
d = list(map(int, readline().split()))
k = d[0]
MOD = 1000000007
ans = 0
for i in range(1, num):
    k = lcm(k, d[i])
for i in range(num):
    ans += k // d[i] % MOD
print(ans % MOD)

Fixed submission:
from sys import stdin

def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a

def lcm(a, b):
    return (a * b) // gcd(a, b)

readline = stdin.readline
num = int(readline())
d = list(map(int, readline().split()))
k = 1
MOD = 1000000007
ans = 0
for a in d:
    k = lcm(k, a)
for a in d:
    ans += k // a
print(ans % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from sys import stdin

def lcm(a, b):
    return a // gcd(a, b) * b

def main():
    readline = stdin.readline
    num = int(readline())
    d = list(map(int, readline().split()))
    k = 1
    MOD = 1000000007
    ans = 0
    for a in d:
        k = lcm(k, a)
    for a in d:
        ans += k // a % MOD
    print(ans % MOD)

if __name__ == "__main__":
    main()

Fixed submission:
from sys import stdin

def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a

def lcm(a, b):
    return (a * b) // gcd(a, b)

readline = stdin.readline
num = int(readline())
d = list(map(int, readline().split()))
k = 1
MOD = 1000000007
ans = 0
for a in d:
    k = lcm(k, a)
for a in d:
    ans += k // a
print(ans % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
def lcm(a, b):
    return a // gcd(a, b) * b

def main():
    num = int(input())
    d = list(map(int, input().split()))
    k = 1
    MOD = 1000000007
    ans = 0
    for a in d:
        k = lcm(k, a)
    for a in d:
        ans += k // a % MOD
    print(ans % MOD)

if __name__ == "__main__":
    main()


Fixed submission:
from sys import stdin

def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a

def lcm(a, b):
    return (a * b) // gcd(a, b)

readline = stdin.readline
num = int(readline())
d = list(map(int, readline().split()))
k = 1
MOD = 1000000007
ans = 0
for a in d:
    k = lcm(k, a)
for a in d:
    ans += k // a
print(ans % MOD)

Buggy python submission (verdict: Runtime Error):
from math import gcd
def lcm(a, b):
    return a // gcd(a, b) * b

def main():
    num = int(input())
    d = list(map(int, input().split()))
    k = 1
    MOD = 1000000007
    ans = 0
    for a in d:
        k = lcm(k, a)
    for a in d:
        ans += k // a % MOD
    print(ans % MOD)

if __name__ == "__main__":
    main()


Fixed submission:
from sys import stdin

def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a

def lcm(a, b):
    return (a * b) // gcd(a, b)

readline = stdin.readline
num = int(readline())
d = list(map(int, readline().split()))
k = 1
MOD = 1000000007
ans = 0
for a in d:
    k = lcm(k, a)
for a in d:
    ans += k // a
print(ans % MOD)