import java.io.{BufferedReader, InputStreamReader}

import scala.collection.mutable

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val n = in.readLine().toInt
    val as = in.readLine().split("\\s+").map(_.toInt)

    val MOD = 1000000000L + 7

    def primes(n: Int): mutable.HashMap[Int, Int] = {
      val ps = new mutable.HashMap[Int, Int]()
      var t = n
      var i = 2

      while (t > 1) {
        if (t % i == 0) {
          ps.update(i, ps.getOrElseUpdate(i, 0) + 1)
          t = t / i
        } else {
          i = i + 1
        }
      }
      ps
    }

    val asPrimes = as.map { a =>
      primes(a)
    }

    val lcmPrimes = asPrimes.foldLeft(new mutable.HashMap[Int, Int]) {
      case (acc, primes) =>
        primes.foreach {
          case (key, value) =>
            if (acc.getOrElse(key, 0) < value) {
              acc.update(key, value)
            }
        }
        acc
    }

    val bsPrimes = asPrimes.map { aPrimes =>
      val bPrimes = new mutable.HashMap[Int, Int]()
      lcmPrimes.foreach {
        case (key, value) =>
          bPrimes.update(key, bPrimes.getOrElse(key, 0) + (value - aPrimes.getOrElse(key, 0)))
      }
      bPrimes
    }

    def pow(a: Long, b: Int): Long = {
      var acc = 1L

      for {
        i <- 1 to b
      } {
        acc = (acc * a) % MOD
      }
      acc
    }

    System.out.println(
      bsPrimes.foldLeft(0L) {
        case (sum, bPrimes) =>
          (sum + bPrimes.foldLeft(1L) {
            case (sum, (key, value)) =>
              (sum * pow(key, value)) % MOD
          }) % MOD
      }
    )
  }
}
