Buggy python submission (verdict: Time Limit Exceeded):
def main():
    from fractions import gcd

    MOD = 10 ** 9 + 7

    N = int(input())
    A = list(map(int, input().split()))

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += (tmp // a)
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    from fractions import gcd

    MOD = 10 ** 9 + 7

    N = int(input())
    A = list(map(int, input().split()))

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += (tmp // a) % MOD
        ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

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

MOD = 10 ** 9 + 7

N = int(input())
A = list(map(int, input().split()))

tmp = 1
for a in A:
    tmp *= a // gcd(tmp, a)

ans = 0
for a in A:
    ans += (tmp // a) % MOD
    ans %= MOD

print (ans)


Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
from fractions import gcd

MOD = 10 ** 9 + 7

N = int(input())
A = list(map(int, input().split()))

tmp = 1
for a in A:
    tmo *= a // gcd(tmp, a)

ans = 0
for a in A:
    ans += (tmp // a) % MOD
    ans %= MOD

print (ans)
    

Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
from fractions import gcd

MOD = 10 ** 9 + 7

N = int(input())
A = list(map(int, input().split()))

tmp = 1
for a in A:
    tmo *= a // gcd(tmp, a)

ans = 0
for a in A:
    ans += (tmp // a) MOD
    ans %= MOD

print (ans)
    

Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    from fractions import gcd

    MOD = 10 ** 9 + 7

    N = int(input())

    A = list(map(int, input().split()))

    B = [1] * (N + 1)

    for index, a in enumerate(A):
        tmp = gcd(B[index], a)
        B[index + 1] = B[index] * a // tmp

    C = [1] * (N + 1)
    for i in range(N - 1, -1, -1):
        tmp =gcd(C[i + 1], A[i])
        C[i] = C[i + 1] * A[i] // tmp

    # print (B)
    # print (C)

    ans = 0
    for i in range(N):
        tmp1 = gcd(B[i], C[i + 1])
        tmp2 = B[i] * C[i + 1] // tmp1

        tmp3 = gcd(tmp2, A[i])
        tmp4 = tmp2 * A[i] // tmp3

        ans += (tmp4 * pow(A[i], MOD - 2, MOD) % MOD)
        ans %= MOD

        # print (ans)

    print (ans)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    from fractions import gcd

    MOD = 10 ** 9 + 7

    N = int(input())

    A = list(map(int, input().split()))

    B = [1] * (N + 1)

    for index, a in enumerate(A):
        tmp = gcd(B[index], a)
        B[index + 1] = B[index] * a // tmp

    C = [1] * (N + 1)
    for i in range(N - 1, -1, -1):
        tmp =gcd(C[i + 1], A[i])
        C[i] = C[i + 1] * A[i] // tmp

    # print (B)
    # print (C)

    ans = 0
    for i in range(N):
        tmp1 = gcd(B[i], C[i + 1])
        tmp2 = B[i] * C[i + 1] // tmp1

        tmp3 = gcd(tmp2, A[i])
        tmp4 = tmp2 * A[i] // tmp3

        ans += (tmp4 // A[i] % MOD)
        ans %= MOD

        # print (ans)

    print (ans)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

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

MOD = 10 ** 9 + 7

N = int(input())

A = list(map(int, input().split()))

B = [1] * (N + 1)

for index, a in enumerate(A):
    tmp = gcd(B[index], a)
    B[index + 1] = B[index] * a // tmp

C = [1] * (N + 1)
for i in range(N - 1, -1, -1):
    tmp =gcd(C[i + 1], A[i])
    C[i] = C[i + 1] * A[i] // tmp

# print (B)
# print (C)

ans = 0
for i in range(N):
    tmp1 = gcd(B[i], C[i + 1])
    tmp2 = B[i] * C[i + 1] // tmp1

    tmp3 = gcd(tmp2, A[i])
    tmp4 = tmp2 * A[i] // tmp3

    ans += (tmp4 // A[i] % MOD)
    ans %= MOD

    # print (ans)

print (ans)

Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
from collections import gcd

MOD = 10 ** 9 + 7

N = int(input())

A = list(map(int, input().split()))

B = [1] * (N + 1)

for index, a in enumerate(A):
    tmp = gcd(B[index], a)
    B[index + 1] = B[index] * a // tmp

C = [1] * (N + 1)
for i in range(N - 1, -1, -1):
    tmp =gcd(C[i + 1], A[i])
    C[i] = C[i + 1] * A[i] // tmp

# print (B)
# print (C)

ans = 0
for i in range(N):
    tmp1 = gcd(B[i], C[i + 1])
    tmp2 = B[i] * C[i + 1] // tmp1

    tmp3 = gcd(tmp2, A[i])
    tmp4 = tmp2 * A[i] // tmp3

    ans += (tmp4 // A[i] % MOD)
    ans %= MOD

    # print (ans)

print (ans)

Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
from math import gcd

MOD = 10 ** 9 + 7

N = int(input())

A = list(map(int, input().split()))

B = [1] * (N + 1)

for index, a in enumerate(A):
    tmp = gcd(B[index], a)
    B[index + 1] = B[index] * a // tmp

C = [1] * (N + 1)
for i in range(N - 1, -1, -1):
    tmp =gcd(C[i + 1], A[i])
    C[i] = C[i + 1] * A[i] // tmp

# print (B)
# print (C)

ans = 0
for i in range(N):
    tmp1 = gcd(B[i], C[i + 1])
    tmp2 = B[i] * C[i + 1] // tmp1

    tmp3 = gcd(tmp2, A[i])
    tmp4 = tmp2 * A[i] // tmp3

    ans += (tmp4 // A[i] % MOD)
    ans %= MOD

    # print (ans)

print (ans)

Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
        ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
        ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

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

N = int(input())
A = list(map(int, input().split()))

MOD = 10 ** 9 + 7

tmp = 1
for a in A:
    tmp *= a // gcd(tmp, a)

ans = 0
for a in A:
    ans += tmp // a
    ans %= MOD

print (ans)

Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10 ** 9 + 7

N = int(input())
A = list(map(int, input().split()))

import math

def factoring(k): #kを因数分解し、素因数とその個数を辞書に入れて返す。
    dic = dict()
    n = int(math.sqrt(k))+2
    for i in range(2, n):
        count = 0
        while k%i == 0:
            count += 1
            k = k//i
        if count != 0:
            dic[i] = count
    if k != 1: #sqrt(k)までチェックしてもkが1になっていない --> kが素因数
        dic[k] = 1
    return dic


lst = [0] * (10 ** 6 + 1)
for a in A:
    dic = factoring(a)
    for d in dic:
        lst[d] = max(lst[d], dic[d])

tmp = 1
for index, x in enumerate(lst):
    tmp *= index ** x

# print (tmp)

ans = 0
for a in A:
    ans += tmp // a
    ans %= MOD

print (ans)

Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10 ** 9 + 7

N = int(input())
A = list(map(int, input().split()))

import math

def factoring(k): #kを因数分解し、素因数とその個数を辞書に入れて返す。
    dic = dict()
    n = int(math.sqrt(k))+2
    for i in range(2, n):
        count = 0
        while k%i == 0:
            count += 1
            k = k//i
        if count != 0:
            dic[i] = count
    if k != 1: #sqrt(k)までチェックしてもkが1になっていない --> kが素因数
        dic[k] = 1
    return dic


lst = [0] * (10 ** 6 + 1)
for a in A:
    dic = factoring(a)
    for d in dic:
        lst[d] = max(lst[d], dic[d])

tmp = 1
for index, x in enumerate(lst):
    tmp *= index ** x

# print (tmp)

ans = 0
for a in A:
    ans += tmp // a
    ans %= MOD

print (ans)

Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    from fractions import gcd
    from functools import reduce


    MOD = 10 ** 9 + 7

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

    def lcm(*numbers):
        return reduce(lcm_base, numbers, 1)

    def lcm_list(numbers):
        return reduce(lcm_base, numbers, 1)

    N = int(input())
    A = list(map(int, input().split()))

    tmp = lcm(*A)

    # print (tmp)
    ans = 0
    for a in A:
        ans += tmp // a
        ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from functools import reduce


MOD = 10 **9 + 7

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input())
A = list(map(int, input().split()))

tmp = lcm(*A)

ans = 0
for a in A:
    ans += tmp // a
    ans %= MOD

print (ans)

Fixed submission:
def main():
    from fractions import gcd

    N = int(input())
    A = list(map(int, input().split()))

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()