from fractions import gcd

import sys 

input = sys.stdin.readline



def pow_mod(x,n):

    if n==0:

        return 1

    

    K = 1

    while n>1:

        if n%2 != 0:

            K *= x

            K %= mod

        x *= x

        x %= mod

        n //= 2



    return K*x



mod=10**9+7

N = int(eval(input()))

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



if N==1:

    print((1))

    exit()



Gcd = gcd(A[0],A[1])

ans = (A[0]//Gcd+A[1]//Gcd)%mod

temp = A[0]//Gcd



for i in range(1,N-1):

    #Gcd = lcm(A[i],A[i+1])

    Gcd = gcd(A[i],A[i+1])

    #temp2 = Gcd//A[i]

    temp2 = A[i+1]//Gcd

    #Gcd2 = lcm(temp,temp2)

    Gcd2 = gcd(temp,temp2)



    #a = Gcd2//temp

    a = temp2//Gcd2

    #b = Gcd2//temp2

    b = temp//Gcd2



    temp = A[i]//Gcd*b



    a %= mod

    b %= mod

    ans *= a

    ans %= mod





    Gcd %= mod #注意

    c = A[i]

    c %= mod

    d = c*pow_mod(Gcd,mod-2)

    #d = Gcd//c

    d %= mod





    e = b*d%mod

    ans += e

    #ans += Gcd//A[i+1]*b

    ans %= mod





print(ans)





import sys

input = sys.stdin.readline





#main関数

def main():

    """"ここに今までのコード"""



    N = int(eval(input()))

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

    mod = 10**9+7



    plist = [0]*1000

    lcm = 1

    nokori=set()

    for a in A:

        for j in range(2, 1001):

            count_j=0

            while a % j == 0:

                count_j += 1

                a //= j

            plist[j-1]=max(plist[j-1],count_j)

        nokori |= {a}

    for x in nokori:

        lcm *= x

        lcm %= mod



    #print(plist)

    #print(lcm)

    for i in range(1000):

        lcm *= pow(i+1, plist[i], mod)

        lcm %= mod

    

    #print(lcm)

    ans = 0



    for a in A:

        ans += lcm * pow(a, mod-2, mod)

        ans %= mod



    print(ans)





if __name__ == '__main__':

    main()



from fractions import gcd
import sys

input = sys.stdin.readline


def pow_mod(x, n):
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
            K %= mod
        x *= x
        x %= mod
        n //= 2
    return K * x


mod = 10**9 + 7
N = int(eval(input()))
A = list(map(int, input().split()))
if N == 1:
    print((1))
    exit()
Gcd = gcd(A[0], A[1])
ans = (A[0] // Gcd + A[1] // Gcd) % mod
temp = A[0] // Gcd
for i in range(1, N - 1):
    # Gcd = lcm(A[i],A[i+1])
    Gcd = gcd(A[i], A[i + 1])
    # temp2 = Gcd//A[i]
    temp2 = A[i + 1] // Gcd
    # Gcd2 = lcm(temp,temp2)
    Gcd2 = gcd(temp, temp2)
    # a = Gcd2//temp
    a = temp2 // Gcd2
    # b = Gcd2//temp2
    b = temp // Gcd2
    temp = A[i] // Gcd * b
    a %= mod
    b %= mod
    ans *= a
    ans %= mod
    Gcd %= mod  # 注意
    c = A[i]
    c %= mod
    d = c * pow_mod(Gcd, mod - 2)
    # d = Gcd//c
    d %= mod
    e = b * d % mod
    ans += e
    # ans += Gcd//A[i+1]*b
    ans %= mod
print(ans)

import sys

input = sys.stdin.readline
# main関数
def main():
    """ "ここに今までのコード"""
    N = int(eval(input()))
    A = list(map(int, input().split()))
    mod = 10**9 + 7
    plist = [0] * 1000
    lcm = 1
    nokori = set()
    for a in A:
        for j in range(2, 1001):
            count_j = 0
            while a % j == 0:
                count_j += 1
                a //= j
            plist[j - 1] = max(plist[j - 1], count_j)
        nokori |= {a}
    for x in nokori:
        lcm *= x
        lcm %= mod
    # print(plist)
    # print(lcm)
    for i in range(1000):
        lcm *= pow(i + 1, plist[i], mod)
        lcm %= mod
    # print(lcm)
    ans = 0
    for a in A:
        ans += lcm * pow(a, mod - 2, mod)
        ans %= mod
    print(ans)


if __name__ == "__main__":
    main()

-from fractions import gcd +# main関数 +def main(): +    """ "ここに今までのコード""" +    N = int(eval(input())) +    A = list(map(int, input().split())) +    mod = 10**9 + 7 +    plist = [0] * 1000 +    lcm = 1 +    nokori = set() +    for a in A: +        for j in range(2, 1001): +            count_j = 0 +            while a % j == 0: +                count_j += 1 +                a //= j +            plist[j - 1] = max(plist[j - 1], count_j) +        nokori |= {a} +    for x in nokori: +        lcm *= x +        lcm %= mod +    # print(plist) +    # print(lcm) +    for i in range(1000): +        lcm *= pow(i + 1, plist[i], mod) +        lcm %= mod +    # print(lcm) +    ans = 0 +    for a in A: +        ans += lcm * pow(a, mod - 2, mod) +        ans %= mod +    print(ans) -def pow_mod(x, n): -    if n == 0: -        return 1 -    K = 1 -    while n > 1: -        if n % 2 != 0: -            K *= x -            K %= mod -        x *= x -        x %= mod -        n //= 2 -    return K * x - - -mod = 10**9 + 7 -N = int(eval(input())) -A = list(map(int, input().split())) -if N == 1: -    print((1)) -    exit() -Gcd = gcd(A[0], A[1]) -ans = (A[0] // Gcd + A[1] // Gcd) % mod -temp = A[0] // Gcd -for i in range(1, N - 1): -    # Gcd = lcm(A[i],A[i+1]) -    Gcd = gcd(A[i], A[i + 1]) -    # temp2 = Gcd//A[i] -    temp2 = A[i + 1] // Gcd -    # Gcd2 = lcm(temp,temp2) -    Gcd2 = gcd(temp, temp2) -    # a = Gcd2//temp -    a = temp2 // Gcd2 -    # b = Gcd2//temp2 -    b = temp // Gcd2 -    temp = A[i] // Gcd * b -    a %= mod -    b %= mod -    ans *= a -    ans %= mod -    Gcd %= mod  # 注意 -    c = A[i] -    c %= mod -    d = c * pow_mod(Gcd, mod - 2) -    # d = Gcd//c -    d %= mod -    e = b * d % mod -    ans += e -    # ans += Gcd//A[i+1]*b -    ans %= mod -print(ans) +if __name__ == "__main__": +    main()