#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;

const long long MOD = 1000000007;

template <typename T> class Factorial {
  public:
    vector<T> fact;
    vector<T> factinv;
    Factorial(int N);
    static T bipow(T c, T n);
    static T square(T n);
    T conv(T n, T m) const;
    T perm(T n, T m) const;
};

template <typename T> Factorial<T>::Factorial(int N) : fact(N+1), factinv(N+1) {
  fact[0] = 1;
  for (int i = 1; i < N+1; i++) {
    fact[i] = fact[i-1]*static_cast<T>(i)%MOD;
  }
  factinv[N] = bipow(fact[N], MOD-2);
  for (int i = N; i > 0; i--) {
    factinv[i-1] = factinv[i]*static_cast<T>(i)%MOD;
  }
}

template <typename T> T Factorial<T>::bipow(T c, T n) {
  if (n == 0) {
    return 1;
  } else if(n == 1) {
    return c;
  } else if(n%2 == 0) {
    return square(bipow(c, n/2))%MOD;
  } else {
    return (static_cast<T>(c)*square(bipow(c, (n-1)/2)))%MOD;
  }
}

template <typename T> T Factorial<T>::square(T n) {
  return static_cast<long long>(n)*n%MOD;
}

template <typename T> T Factorial<T>::conv(T n, T m) const {
  if (n < m) {
    return 0;
  }
  return (((static_cast<long long>(fact[n])*factinv[m])%MOD)*factinv[n-m])%MOD;
}

template <typename T> T Factorial<T>::perm(T n, T m) const {
    if (n < m) {
      return 0;
    }
    return (static_cast<long long>(fact[n])*factinv[n-m])%MOD;
}

std::vector<bool> IsPrime;
vector<long long> primes;
vector<long long> fs(1000000, 0);

void sieve(size_t max){
    if(max+1 > IsPrime.size()){     // resizeで要素数が減らないように
        IsPrime.resize(max+1,true); // IsPrimeに必要な要素数を確保
    }
    IsPrime[0] = false; // 0は素数ではない
    IsPrime[1] = false; // 1は素数ではない

    for(size_t i=2; i*i<=max; ++i) {// 0からsqrt(max)まで調べる
        if(IsPrime[i]) { // iが素数ならば
            for(size_t j=2; i*j<=max; ++j) {// (max以下の)iの倍数は
                IsPrime[i*j] = false;      // 素数ではない
            }
        }
    }
}

long long gcd(long long a, long long b) {
  long long t;
  while (b > 0) {
    t = b;
    b = a % b;
    a = t;
  }
  return a;
}

void solve(long long N, std::vector<long long> A){
  Factorial<long long> fact(1000001);
  long long r, ret;
  r = gcd(A[0], A[1]);
  for (int i = 0; i < N; ++i) {
    r = gcd(r, A[i]);
  }
  for (int i = 0; i < N; ++i) {
    A[i] = A[i] / r;
  }
  ret = 0;
  sieve(1000000);
  for (int i = 0; i <= 1000; ++i) {
    if (IsPrime[i]) {
      primes.push_back(i);
    }
  }
  long long  t, c, m;
  for (int i = 0; i < N; ++i) {
    t = A[i];
    for (int j = 0; j < primes.size(); j++) {
      c = 0;
      while (true) {
        if (t % primes[j] == 0 && t != 0) {
          c++;
          t /= primes[j];
        } else {
          break;
        }
      }
      fs[primes[j]] = max(c, fs[primes[j]]);
    }
    if (IsPrime[t]) {
      fs[t] = 1;
    }
  }
  m = 1;
  for (int i = 0; i <= 1000000; ++i) {
    if (IsPrime[i]) {
      for (int j = 0; j < fs[i]; ++j) {
        m *= i;
        m %= MOD;
      }
    }
  }

  for (int i = 0; i < N; i++) {
    ret += (m * fact.factinv[A[i]] % MOD) * fact.fact[A[i]-1] % MOD;
    ret %= MOD;
  }
  std::cout << ret << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> A(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&A[i]);
  }
  solve(N, std::move(A));
  return 0;
}


Measured memory_bytes: 23936