#include<bits/stdc++.h>
using namespace std;

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';
#define N 1000000007 // prime modulo value 

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

/*vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
*/
// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, k, m, r;
string s;
ll prime[1000035];
unordered_map<ll,ll> ans,A;
	
// <------------- Implement Functions Here ----------> //

  
long long exponentiation(long long base, 
                        long long exp) 
{ 
    if (exp == 0) 
        return 1; 
  
    if (exp == 1) 
        return base % N; 
  
    long long t = exponentiation(base, exp / 2); 
    t = (t * t) % N; 
  
    // if exponent is even value 
    if (exp % 2 == 0) 
        return t; 
  
    // if exponent is odd value 
    else
        return ((base % N) * t) % N; 
} 

void PRIME() {
	for (ll i = 0; i <= 1000000; i++) {
		prime[i] = i;
	}

	for (ll i = 4; i <= 1000000; i += 2) {
		prime[i] = 2;
	}

	for (ll i = 3; i <= 1000000; i += 2) {
		if (prime[i] == i) {
			for (ll j = i * i; j <= 1000000; j += i) {
				if (prime[j] == j) prime[j] = i;
			}
		}
	}
}

ll multiply(ll a, ll b) {
	return (a % MOD * b % MOD) % MOD;
}

unordered_map<ll , ll> factorize(ll x) {
	unordered_map<ll, ll> ans;

	while (x > 1) {
		ll m = prime[x];
		while (x % m == 0) {
			ans[m] = (ans[m] + 1);
			x /= m;
		}
	}
	return ans;
}

// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n;
	vll a(n);
	ll sum = 0;
	
	for(ll i=0;i<n;i++) {
		cin >> x;
		a[i] = x;
		A = factorize(x);
		for(auto it : A) {
			ans[it.f] = max(it.s,ans[it.f]);
		}
	}
	
	for(ll i=0;i<n;i++) {
		x = a[i];
		A = factorize(x);
		for(auto it : A) {
			ans[it.f] -= it.s;
		}

		ll prod = 1;
		for(auto it : ans) {
			prod = multiply(prod,exponentiation(it.f,it.s));
		}
		
		sum = (sum + prod)%MOD;

		for(auto it : A) {
			ans[it.f] += it.s;
		}
	}

	cout<<sum;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	PRIME();
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 11896