Language: C++

#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

template<int MOD> struct Fp {
	long long val;
	constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
		if (val < 0) v += MOD;
	}
	constexpr int getmod() { return MOD; }
	constexpr Fp operator - () const noexcept {
		return val ? MOD - val : 0;
	}
	constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
	constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
	constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
	constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
	constexpr Fp& operator += (const Fp& r) noexcept {
		val += r.val;
		if (val >= MOD) val -= MOD;
		return *this;
	}
	constexpr Fp& operator -= (const Fp& r) noexcept {
		val -= r.val;
		if (val < 0) val += MOD;
		return *this;
	}
	constexpr Fp& operator *= (const Fp& r) noexcept {
		val = val * r.val % MOD;
		return *this;
	}
	constexpr Fp& operator /= (const Fp& r) noexcept {
		long long a = r.val, b = MOD, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % MOD;
		if (val < 0) val += MOD;
		return *this;
	}
	constexpr bool operator == (const Fp& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Fp& r) const noexcept {
		return this->val != r.val;
	}
	friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
		return os << x.val;
	}
	friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
		return is >> x.val;
	}
	friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
		if (n == 0) return 1;
		auto t = modpow(a, n / 2);
		t = t * t;
		if (n & 1) t = t * a;
		return t;
	}
};

const int MOD = 1000000007;
using mint = Fp<MOD>;

mint lcm(mint x,mint y){
	mint ans = x*y;
	ans /= __gcd(x.val,y.val);
	return ans;
}

typedef mint RUI;//型は適当に合わせて.
RUI rui(ll num,ll k){//num^k
	RUI ans = 1;
	RUI n = num;
	while(k>0){
		if(k&1)ans *= n;
		n *= n;
		k /= 2;
	}
	return ans;
}


ll n;
Vi a;
vector<PLL> fact(ll num){
	vector<PLL> ans;
	ll a = 2;
	ll ct = 0;
	while(a<=num){
		ct = 0;
		while(num%a==0){
			num /= a;
			ct++;
		}
		if(ct!=0)ans.pb(mp(a,ct));
		a++;
	}
	return ans;
}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	std::cout<<std::fixed<<std::setprecision(30);
	cin>>n;
	a.resize(n);
	rep(i,n){
		cin>>a[i];
	}
	map<ll,ll> ma;
	set<ll> st;
	vector<vector<PLL>> vpp(n);
	rep(i,n){
		vector<PLL> vp = fact(a[i]);
		vpp[i] = vp;
		for(auto& id: vp){
			chmax(ma[id.first],id.second);
			st.insert(id.first);
		}
	}
	mint ans=0;
	map<ll,ll> md;
	rep(i,n){
		mint nok=1;
		md.clear();
		rep(j,vpp[i].size()){
			md[vpp[i][j].first] = vpp[i][j].second;
		}
		for(auto& id: st){
			nok *= rui(id,ma[id]-md[id]);
		}
		ans += nok;
	}
	print(ans);
	return 0;
}#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

template<int MOD> struct Fp {
	long long val;
	constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
		if (val < 0) v += MOD;
	}
	constexpr int getmod() { return MOD; }
	constexpr Fp operator - () const noexcept {
		return val ? MOD - val : 0;
	}
	constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
	constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
	constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
	constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
	constexpr Fp& operator += (const Fp& r) noexcept {
		val += r.val;
		if (val >= MOD) val -= MOD;
		return *this;
	}
	constexpr Fp& operator -= (const Fp& r) noexcept {
		val -= r.val;
		if (val < 0) val += MOD;
		return *this;
	}
	constexpr Fp& operator *= (const Fp& r) noexcept {
		val = val * r.val % MOD;
		return *this;
	}
	constexpr Fp& operator /= (const Fp& r) noexcept {
		long long a = r.val, b = MOD, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % MOD;
		if (val < 0) val += MOD;
		return *this;
	}
	constexpr bool operator == (const Fp& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Fp& r) const noexcept {
		return this->val != r.val;
	}
	friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
		return os << x.val;
	}
	friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
		return is >> x.val;
	}
	friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
		if (n == 0) return 1;
		auto t = modpow(a, n / 2);
		t = t * t;
		if (n & 1) t = t * a;
		return t;
	}
};

const int MOD = 1000000007;
using mint = Fp<MOD>;

mint lcm(mint x,mint y){
	mint ans = x*y;
	ans /= __gcd(x.val,y.val);
	return ans;
}

typedef mint RUI;//型は適当に合わせて.
RUI rui(ll num,ll k){//num^k
	RUI ans = 1;
	RUI n = num;
	while(k>0){
		if(k&1)ans *= n;
		n *= n;
		k /= 2;
	}
	return ans;
}


ll n;
Vi a;
vector<PLL> fact(ll num){
	vector<PLL> ans;
	ll a = 2;
	ll ct = 0;
	while(a<=num){
		ct = 0;
		while(num%a==0){
			num /= a;
			ct++;
		}
		if(ct!=0)ans.pb(mp(a,ct));
		a++;
	}
	return ans;
}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	std::cout<<std::fixed<<std::setprecision(30);
	cin>>n;
	a.resize(n);
	rep(i,n){
		cin>>a[i];
	}
	map<ll,ll> ma;
	set<ll> st;
	vector<vector<PLL>> vpp(n);
	rep(i,n){
		vector<PLL> vp = fact(a[i]);
		vpp[i] = vp;
		for(auto& id: vp){
			chmax(ma[id.first],id.second);
			st.insert(id.first);
		}
	}
	mint ans=0;
	map<ll,ll> md;
	rep(i,n){
		mint nok=1;
		md.clear();
		rep(j,vpp[i].size()){
			md[vpp[i][j].first] = vpp[i][j].second;
		}
		for(auto& id: st){
			nok *= rui(id,ma[id]-md[id]);
		}
		ans += nok;
	}
	print(ans);
	return 0;
}

Compiler output:
a.cc:159:2: error: stray '#' in program
  159 | }#include "bits/stdc++.h"
      |  ^
a.cc:159:3: error: 'include' does not name a type
  159 | }#include "bits/stdc++.h"
      |   ^~~~~~~
a.cc:162:21: error: redefinition of 'const long long int INF'
  162 | const long long int INF = 1LL<<60;
      |                     ^~~
a.cc:4:21: note: 'const long long int INF' previously defined here
    4 | const long long int INF = 1LL<<60;
      |                     ^~~
a.cc:163:21: error: redefinition of 'const long long int Mod'
  163 | const long long int Mod = 1000000007;
      |                     ^~~
a.cc:5:21: note: 'const long long int Mod' previously defined here
    5 | const long long int Mod = 1000000007;
      |                     ^~~
a.cc:173:23: error: redefinition of 'template<class T> bool chmax(T&, const T&)'
  173 | template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
      |                       ^~~~~
a.cc:15:23: note: 'template<class T> bool chmax(T&, const T&)' previously declared here
   15 | template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
      |                       ^~~~~
a.cc:174:23: error: redefinition of 'template<class T> bool chmin(T&, const T&)'
  174 | template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
      |                       ^~~~~
a.cc:16:23: note: 'template<class T> bool chmin(T&, const T&)' previously declared here
   16 | template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
      |                       ^~~~~
a.cc:175:20: error: redefinition of 'template<class T> T sqar(T)'
  175 | template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
      |                    ^~~~
a.cc:17:20: note: 'template<class T> T sqar(T)' previously declared here
   17 | template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
      |                    ^~~~
a.cc:178:31: error: redefinition of 'template<class T> void princ(T)'
  178 | template<class T> inline void princ(T x){cout<<x<<" ";};
      |                               ^~~~~
a.cc:20:31: note: 'template<class T> void princ(T)' previously declared here
   20 | template<class T> inline void princ(T x){cout<<x<<" ";};
      |                               ^~~~~
a.cc:179:31: error: redefinition of 'template<class T> void print(T)'
  179 | template<class T> inline void print(T x){cout<<x<<"\n";};
      |                               ^~~~~
a.cc:21:31: note: 'template<class T> void print(T)' previously declared here
   21 | template<class T> inline void print(T x){cout<<x<<"\n";};
      |                               ^~~~~
a.cc:180:31: error: redefinition of 'template<class T> void Yes(T)'
  180 | template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
      |                               ^~~
a.cc:22:31: note: 'template<class T> void Yes(T)' previously declared here
   22 | template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
      |                               ^~~
a.cc:181:31: error: redefinition of 'template<class T> void YES(T)'
  181 | template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
      |                               ^~~
a.cc:23:31: note: 'template<class T> void YES(T)' previously declared here
   23 | template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
      |                               ^~~
a.cc:184:26: error: redefinition of 'struct Fp<MOD>'
  184 | template<int MOD> struct Fp {
      |                          ^~
a.cc:26:26: note: previous definition of 'struct Fp<MOD>'
   26 | template<int MOD> struct Fp {
      |                          ^~
a.cc:243:11: error: redefinition of 'const int MOD'
  243 | const int MOD = 1000000007;
      |           ^~~
a.cc:85:11: note: 'const int MOD' previously defined here
   85 | const int MOD = 1000000007;
      |           ^~~
a.cc:246:6: error: redefinition of 'mint lcm(mint, mint)'
  246 | mint lcm(mint x,mint y){
      |      ^~~
a.cc:88:6: note: 'mint lcm(mint, mint)' previously defined here
   88 | mint lcm(mint x,mint y){
      |      ^~~
a.cc:253:5: error: redefinition of 'RUI rui(ll, ll)'
  253 | RUI rui(ll num,ll k){//num^k
      |     ^~~
a.cc:95:5: note: 'RUI rui(ll, ll)' previously defined here
   95 | RUI rui(ll num,ll k){//num^k
      |     ^~~
a.cc:265:4: error: redefinition of 'll n'
  265 | ll n;
      |    ^
a.cc:107:4: note: 'll n' previously declared here
  107 | ll n;
      |    ^
a.cc:266:4: error: redefinition of 'Vi a'
  266 | Vi a;
      |    ^
a.cc:108:4: note: 'Vi a' previously declared here
  108 | Vi a;
      |    ^
a.cc:267:13: error: redefinition of 'std::vector<std::pair<long long int, long long int> > fact(ll)'
  267 | vector<PLL> fact(ll num){
      |             ^~~~
a.cc:109:13: note: 'std::vector<std::pair<long long int, long long int> > fact(ll)' previously defined here
  109 | vector<PLL> fact(ll num){
      |             ^~~~
a.cc:283:5: error: redefinition of 'int main()'
  283 | int main(){
      |     ^~~~
a.cc:125:5: note: 'int main()' previously defined here
  125 | int main(){
      |     ^~~~