/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

template <long long Modulus> class mint {
    long long a;
public:

    constexpr mint(const long long a = 0) noexcept : a((a % Modulus + Modulus) % Modulus) {}

    constexpr long long& value() noexcept {
        return a;
    }

    constexpr mint& operator +=(const mint& rhs) noexcept {
        a += rhs.a;
        if (a >= Modulus) a -= Modulus;
        return *this;
    }

    constexpr mint& operator -=(const mint& rhs) noexcept {
        a += Modulus - rhs.a;
        if (a >= Modulus) a -= Modulus;
        return *this;
    }

    constexpr mint& operator *=(const mint& rhs) noexcept {
        a = a * rhs.a % Modulus;
        return *this;
    }

    constexpr mint operator +(const mint rhs) const noexcept {
        return mint(*this) += rhs;
    }

    constexpr mint operator -(const mint rhs) const noexcept {
        return mint(*this) -= rhs;
    }

    constexpr mint operator *(const mint &rhs) const noexcept {
        return mint(*this) *= rhs;
    }

    constexpr mint pow(long long t) const noexcept {
        if (!t) return 1;
        mint<Modulus> ret = pow(t >> 1u);
        ret *= ret;
        if (t & 1) ret *= *this;
        return ret;
    }

    constexpr mint inv() const noexcept {
        return pow(Modulus - 2);
    }

    constexpr mint operator /=(const mint rhs) {
        return (*this) *= rhs.inv();
    }

    constexpr mint operator /(const mint &rhs) const noexcept {
        return mint(*this) /= rhs;
    }
};

using mi = mint<MOD>;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

int lcm(int a, int b) {
    return a / gcd(a, b) * b;
}

mi gcd(mi a, mi b) {
    int av = a.value();
    int bv = b.value();
    if (bv == 0) return a;
    int tmp = av % bv;
    return gcd(b, mi(tmp));
}

mi lcm(mi a, mi b) {
    return a / gcd(a, b) * b;
}

unordered_map<int, int> prime_factor(int n) {
    unordered_map<int, int> ret;
    for (int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }

    if (n != 1) ret[n] = 1;
    return ret;
};

int powmod(int a, int p, int mod) {
    int ans = 1;
    int mul = a;

    for (; p > 0; p >>= 1, mul = (mul * mul) % mod) {
        if ((p & 1) == 1) ans = (ans * mul) % mod;
    }

    return ans;
}

signed main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        A[i] = a;
    }

    unordered_map<int, unordered_map<int, int>> factors;

    unordered_map<int, int> vm;
    for (int i = 0; i < N; i++) {
        factors[A[i]] = prime_factor(A[i]);
        auto &m = factors[A[i]];
        for (auto it = m.begin(); it != m.end(); it++) {
            vm[it->first] = max(vm[it->first], it->second);
        }
    }

    //for (auto it = vm.begin(); it != vm.end(); it++) cout << it->first << " " << it->second << endl;

    int ret = 0;
    int L = 1;
    for (auto it = vm.begin(); it != vm.end(); it++) {
        L *= powmod(it->first, it->second, MOD);
        L %= MOD;
    }
    for (int i = 0; i < N; i++) {
        ret += L * powmod(A[i], MOD-2, MOD);
        ret %= MOD;
    }

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 2944