Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from functools import reduce
import sys
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

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

def solve(N, A):
    mod = 10 ** 9 + 7
    lcm = lcm_list(A)
    ans = [lcm//a for a in A]
    return sum(ans) % mod


def main():
    read = sys.stdin.buffer.read
    
    N,*A = map(int,read().split())
    ans = solve(N, A)
    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
from fractions import gcd
from functools import reduce
import sys
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
def solve(N, A):
    mod = 10 ** 9 + 7
    lcm = lcm_list(A)
    ans = [lcm//a for a in A]
    return sum(ans) % mod
    
 
def main():
    read = sys.stdin.buffer.read
    N,*A = map(int,read().split())
    ans = solve(N, A)
    print(ans)
 
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from functools import reduce
import sys
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

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

def solve(N, A):
    mod = 10 ** 9 + 7
    lcm = lcm_list(A)
    ans = [lcm//a for a in A]
    return sum(ans) % mod


def main():
    read = sys.stdin.buffer.read
    
    N,*A = map(int,read().split())
    ans = solve(N, A)
    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
from fractions import gcd
from functools import reduce
import sys
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
def solve(N, A):
    mod = 10 ** 9 + 7
    lcm = lcm_list(A)
    ans = [lcm//a for a in A]
    return sum(ans) % mod
    
 
def main():
    read = sys.stdin.buffer.read
    N,*A = map(int,read().split())
    ans = solve(N, A)
    print(ans)
 
if __name__ == "__main__":
    main()

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

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

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

def solve(N, A):
    mod = 10 ** 9 + 7
    lcm = lcm_list(A)
    ans = [lcm//a for a in A]
    return sum(ans) % mod


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    ans = solve(N, A)
    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
from fractions import gcd
from functools import reduce
import sys
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
def solve(N, A):
    mod = 10 ** 9 + 7
    lcm = lcm_list(A)
    ans = [lcm//a for a in A]
    return sum(ans) % mod
    
 
def main():
    read = sys.stdin.buffer.read
    N,*A = map(int,read().split())
    ans = solve(N, A)
    print(ans)
 
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

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

def solve(N, A):
    mod = 10 ** 9 + 7
    lcm = lcm_list(A)
    ans = [lcm//a for a in A]
    return sum(ans) % mod
    

def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    ans = solve(N, A)
    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
from fractions import gcd
from functools import reduce
import sys
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
def solve(N, A):
    mod = 10 ** 9 + 7
    lcm = lcm_list(A)
    ans = [lcm//a for a in A]
    return sum(ans) % mod
    
 
def main():
    read = sys.stdin.buffer.read
    N,*A = map(int,read().split())
    ans = solve(N, A)
    print(ans)
 
if __name__ == "__main__":
    main()