val MOD = 1000000007

class MInt(var value: Long) {

    constructor(value: Int) : this(value.toLong())

    operator fun plus(a: MInt): MInt = MInt((this.value + a.value) % MOD)
    operator fun plus(a: Long): MInt = this + MInt(a)
    operator fun plus(a: Int): MInt = this + MInt(a)

    operator fun plusAssign(a: MInt) {
        this.value = (this + a).value
    }

    operator fun plusAssign(a: Long) {
        plusAssign(MInt(a))
    }

    operator fun plusAssign(a: Int) {
        plusAssign(MInt(a))
    }

    operator fun minus(a: MInt) = MInt((this.value - a.value) % MOD)
    operator fun minus(a: Long) = this - MInt(a)
    operator fun minus(a: Int) = this - MInt(a)

    operator fun minusAssign(a: MInt) {
        this.value = (this - a).value
    }

    operator fun minusAssign(a: Long) {
        minusAssign(MInt(a))
    }

    operator fun minusAssign(a: Int) {
        minusAssign(MInt(a))
    }

    operator fun times(a: MInt) = MInt((this.value * a.value) % MOD)
    operator fun times(a: Long) = this * MInt(a)
    operator fun times(a: Int) = this * MInt(a)

//    operator fun timesAssign(a: MInt) {
//        this.value = (this * a).value
//    }
//
//    operator fun timesAssign(a: Long) {
//        timesAssign(MInt(a))
//    }
//
//    operator fun timesAssign(a: Int) {
//        timesAssign(MInt(a))
//    }

    operator fun div(a: MInt) = this * a.inv()
    operator fun div(a: Long) = div(MInt(a))
    operator fun div(a: Int) = div(MInt(a))

    operator fun divAssign(a: MInt) {
        this.value = (this / a).value
    }

    operator fun divAssign(a: Long) {
        divAssign(MInt(a))
    }

    operator fun divAssign(a: Int) {
        divAssign(MInt(a))
    }

    fun pow(b: Int): MInt {
        var res = MInt(1)
        repeat(b) {
            res *= this
        }
        return res

    }

    /**
     * 非再帰拡張 Euclid の互除法
     * 逆元を求める
     */
    fun inv(): MInt {

        var at = this.value.toInt()
        var bt = MOD

        var u = 1
        var v = 0

        var tmp: Int

        while (bt != 0) {
            val t = at / bt
            at -= t * bt
            tmp = at
            at = bt
            bt = tmp

            u -= t * v
            tmp = u
            u = v
            v = tmp
        }

        u %= MOD
        if (u < 0) u += MOD
        return MInt(u.toLong())
    }
}

fun main(args: Array<String>) {
    /**
     * Arrayの添字がIntでしか受け付けない。
     * nはIntの範囲までにする
     */
    class SieveOfEratosthenes(n: Int) {
        val f: IntArray = IntArray(n + 1)
        val primes: List<Int>

        init {
            val primes = mutableListOf<Int>()

            // 0と1に関しては特別扱い
            f[0] = -1
            f[1] = -1

            for (i in 2..n) {
                // 素数判定
                if (f[i] != 0) {
                    continue
                }

                primes.add(i)
                f[i] = i

                // 篩にかける
                // TODO　自身の二乗までは既に計算済みなので・・・　なぜ？
                var j: Long = i * i.toLong()
                while (j <= n) {
                    if (f[j.toInt()] == 0) {
                        f[j.toInt()] = i
                    }
                    j += i
                }
            }

            this.primes = primes.toList()
        }

        fun isPrime(x: Int) = f[x] == x

        fun factor(x: Int): List<Pair<Int, Int>> {
            val res = mutableListOf<Int>()
            var _x = x
            while (_x != 1) {
                res.add(f[_x])
                _x /= f[_x]
            }
            return res.groupBy { it }.map { it.key to it.value.size }
        }
    }


    val N = readLine()!!.toInt()
    val AN = readLine()!!.split(" ").map(String::toInt)

    val sieve = SieveOfEratosthenes(1000000)

    var mp = mutableMapOf<Int, Int>()
    for (a in AN) {
        for (fp in sieve.factor(a)) {
            mp[fp.first] = Math.max(mp.getOrElse(fp.first, { 0 }), fp.second)
        }
    }

    var lcm = MInt(1)
    for ((b, s) in mp) {
        lcm *= MInt(b).pow(s)

    }

    AN.map { i -> lcm / i }.fold(MInt(0)) { i1, i2 -> i1 + i2 }.let { println(it.value) }

}



Measured memory_bytes: 50020