#include <iostream>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <deque>
#include <functional>
#include <initializer_list>
#include <math.h>
#include <map>
#include <random>
#include <set>
#include <stack>
#include <tuple>
#include <queue>
#include <vector>

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); --(i))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define SORT(A) std::sort((A).begin(), (A).end())
#define ALL(A) (A).begin(), (A).end()
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())

using lli = long long int;
using pii = std::pair<int, int>;

// グリッド上の縦横移動
constexpr std::array<std::pair<int, int>, 4> dxdy = {
    std::pair<int, int>( 1,  0),
    std::pair<int, int>(-1,  0),
    std::pair<int, int>( 0,  1),
    std::pair<int, int>( 0, -1)
};

void VintOut(std::vector<int>& A){
    const int n = A.size();
    if(n == 0){putchar('\n'); return;}
    printf("%d", A[0]);
    for(int i = 1; i < n; ++i) printf(" %d", A[i]);
    putchar('\n');
}
void VintOut(std::vector<long long int>& A){
    const int n = A.size();
    if(n == 0){ putchar('\n'); return;}
    printf("%lld", A[0]);
    for(int i = 1; i < n; ++i) printf(" %lld", A[i]);
    putchar('\n');
}

template <typename T>
inline bool chmin(T& a, T b){
    if(b < a){ a = b; return true;}
    return false;
}

template <typename T>
inline bool chmax(T& a, T b){
    if(a < b){ a = b; return true;}
    return false;
}

inline bool isIn(int x, int y, int H, int W){
    return 0 <= x and x < H and 0 <= y and y < W;
}
inline bool bitUP(int state, int k){ return (state >> k) & 1; }
inline bool bitUP(long long int state, int k){ return (state >> k) & 1;}

// z-algorithm
template <class T> std::vector<int> z_algorithm(const T &str) {
    const int n = str.size();
    std::vector<int> resOfCP(n); resOfCP[0] = n;
    int i = 1, j = 0;
    while (i < n) {
        while (i + j < n and str[j] == str[i + j]) ++j;
        resOfCP[i] = j;
        if (j == 0) { ++i; continue;}
        int k = 1;
        while (i + k < n and k + resOfCP[k] < j) resOfCP[i + k] = resOfCP[k], ++k;
        i += k; j -= k;
    }
    return resOfCP;
}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


template <unsigned int N> struct shuumai{
    unsigned int minPrime[N + 1];
    unsigned int Primes[N + 1];
    unsigned int size_;

    constexpr shuumai(void): minPrime(), Primes(), size_(0U){
        minPrime[0] = 1; minPrime[1] = 1;
        for(int even = 2, odd = 3; odd <= N; even += 2, odd += 2){
            minPrime[even] = 2;
            minPrime[odd] = odd;
        }
        if(!(N & 1)) minPrime[N] = 2;
        Primes[size_++] = 2;

        for(int x = 3; x <= N; x += 2){
            if(minPrime[x] == x) Primes[size_++] = x;
            for(int y = 0; y < size_ and Primes[y] <= minPrime[x] and x * Primes[y] <= N; ++y)
                    minPrime[x * Primes[y]] = Primes[y];
        }
    }
    // 範囲for文用の begin() と end()
    const unsigned int *begin(void) const noexcept{ return Primes; }
    const unsigned int *end(void) const noexcept{ return Primes + size_;}
    const unsigned int size(void) const {return this.size_;}
};

using uint = unsigned int;
constexpr uint N = 1e6;
constexpr uint mod = 1e9 + 7;
constexpr shuumai<N> P;
std::array<int, N + 1> Count;

// aの逆元を求める関数
const unsigned int inverse(unsigned int a) noexcept {
    unsigned int b = mod;
             int u = 1,   v = 0;
    while (b != 0) {
        unsigned int t = a / b; 
        a -= t * b; std::swap(a, b);
        u -= t * v; std::swap(u, v);
    }
    if(u < 0) u += mod;
    return u;
}

// a^nを返す関数
const uint power(uint a, uint n)noexcept{
    if(n == 0) return 1U;
    unsigned long long res = 1, waiting = a;
    while(n){ 
        if(n & 1) { res *= waiting; res %= mod; }
        waiting *= waiting; waiting %= mod; 
        n >>= 1;
    }
    return res;
}


int main(void){
    uint n; scanf("%u", &n);
    uint inv_sum = 0;
    for(uint _ = 0; _ < n; ++_){
        uint a; scanf("%u", &a);
        inv_sum += inverse(a); if(inv_sum >= mod) inv_sum -= mod;
        uint fac = 0, cnt = 0;
        while(a != 1U){
            uint f = P.minPrime[a];
            a /= f;
            if(fac != f){
                if(Count[fac] < cnt) Count[fac] = cnt;
                fac = f; cnt = 1;
            }
            else cnt++;
        }
        if(fac != 1){
            if(Count[fac] < cnt) Count[fac] = cnt;
        }
    }

    unsigned long long int lcm = 1;
    for(unsigned int x : P) if(Count[x] > 0) (lcm *= power(x, Count[x])) %= mod;
    unsigned int res = lcm * inv_sum % mod;
    
    printf("%u\n", res);
    return 0;
}

Measured memory_bytes: 3328