#include <bits/stdc++.h>
          using namespace std;
          #define tani_nachi_ke  ios_base::sync_with_stdio(false); cin.tie(NULL);
          #define M_PI 3.14159265358979323846
          #define data data_
          #define ff first
          #define ss second
          #define pb push_back
          #define ll long long
          #define ld long double
          long long const mod = 1e9+7;

          long long mod_power(long long a,long long b,long long mod)
          {
               long long res = 1;
               while(b != 0)
               {
                    if(b&1)
                         res = (res * a)%mod;
                    a = (a * a)%mod;
                    b/=2;
               }
               return res;
          }
          int const N = 1000009;
          
          int spf[N];
          map<int,int> lcm;
          long long fun(map<int,int> &mp)
          {
               long long res = 1;
               for(auto &it:lcm)
               {
                    if(mp.find(it.ff) != mp.end())
                         res = (res*mod_power(it.ff,it.ss - mp[it.ff],mod))%mod;
                    else
                         res = (res * mod_power(it.ff,it.ss,mod))%mod;
               }
               return res;
          }
          int main()
          {
               tani_nachi_ke  


               for(int i = 1; i < N; i++)
                    spf[i] = i;
               for(int i = 2; i*i < N; i++)
               {
                    if(spf[i] != i)
                         continue;
                    for(int j = i*i; j < N; j+=i)
                         if(spf[j] == j)
                              spf[j] = i;
               }
               

               int n;
               cin >> n;
               int a[n+1];
               map<int,map<int,int>> mp;
               for(int i = 1; i <= n; i++)
               {
                    int x;
                    cin >> x;
                    int cur = x;
                    int t = spf[x];
                    a[i] = x;
                    // cout << t << endl;
                    while(x != 1)
                    {
                         int ct = 0;
                         while(x%t == 0)
                         {
                              ct++;
                              x/=t;
                         }
                         mp[cur][t] = ct;
                         t = spf[x];    
                    }
               }
               // for(auto &it:mp)
               // {
               //      cout << it.ff << endl;
               //      for(auto &itt:it.ss)
               //           cout << itt.ff << " " << itt.ss << '\n';
               // }
               
               for(auto &it:mp)
               {
                    for(auto &itt:it.ss)
                         lcm[itt.ff] = max(lcm[itt.ff],itt.ss);
               }
               // for(auto &it:lcm)
               //      cout << it.ff << " " << it.ss << '\n';

               
               long long ans = 0;
               for(int i = 1; i <= n; i++)
               {
                    ans = (ans + fun(mp[a[i]]))%mod;
               }
               cout << ans << '\n';





         
               return 0;
          }

Measured memory_bytes: 6912