#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>


long long int MOD = 1e9+7;

long long int NMAX = 1000000;

int main(){
  
  // read problem
  long long int N, tmp;
  std::vector<long long int> A;

  long long int Atmp;

  scanf("%lld", &N);
  for(long long int i = 0; i < N; i++){
    scanf("%lld", &tmp);
    A.push_back(tmp);
  }

  // make prime table
  std::vector<long long int> prime1tmp(NMAX+1), prime2tmp;

  for(long long int i = 2; i <= NMAX; i++){
    prime1tmp[i] = 1;
  }
  for(long long int i = 2; i*i <= NMAX; i++){
    if(prime1tmp[i] == 1){
      for(long long int j = 2*i; j <= NMAX; j+=i){
        prime1tmp[j] = 0;
      }
    }
  }
  tmp = 0;
  for(long long int i = 0; i <=NMAX; i++){
    if(prime1tmp[i] == 1){
      prime2tmp.push_back(i);
      prime1tmp[i] = tmp;
      tmp++;
    }
  }

  // remake prime table
  std::vector<long long int> prime1(NMAX+1), prime2;
  long long int NPRIME = prime2tmp.size();

  for(long long int i = 0; i < N; i++){
    // prime factorize A[i]
    //for(long long int j = 0; j < NPRIME; j++)tmp_array[j] = 0;

    Atmp = A[i];
    for(long long int j = 0; j < NPRIME && prime2tmp[j]*prime2tmp[j] <= A[i]; j++){
      while(Atmp %prime2tmp[j] == 0){
        Atmp /=prime2tmp[j];
        //tmp_array[j]++;
        prime1[prime2tmp[j]]++;
      }
      if(Atmp == 1)break;  
    }
    if(Atmp > 1){
      prime1[Atmp]++;
    }
  }

  tmp = 0;
  for(long long int i = 0; i <=NMAX; i++){
    if(prime1[i] >= 1){
      prime2.push_back(i);
      prime1[i] = tmp;
      tmp++;
    }
  }

  // solve problem
  NPRIME = prime2.size();

  std::cerr << "prime2:" << std::endl;
  for(long long int i = 0; i < std::min((long long int)10, NPRIME); i++){
    std::cerr << prime2[i] << " ";
  }std::cerr << "..." << std::endl;
  std::cerr << "NPRIME = " << NPRIME << std::endl;

  

  std::vector<long long int> max_exp(NPRIME), tmp_array(NPRIME);
  //std::vector<long long int> tmp_array2()

  for(long long int i = 0; i < N; i++){
    // prime factorize A[i]
    for(long long int j = 0; j < NPRIME; j++)tmp_array[j] = 0;

    Atmp = A[i];
    for(long long int j = 0; j < NPRIME && prime2[j]*prime2[j] <= A[i]; j++){
      while(Atmp %prime2[j] == 0){
        Atmp /=prime2[j];
        tmp_array[j]++;
      }
      if(Atmp == 1)break;
    }
    if(Atmp > 1){
      tmp_array[prime1[Atmp]]++;
    }

    //std::cerr << i << tmp_array[0] << tmp_array[1] << std::endl;

    // calculate max_exp
    for(long long int j = 0; j < NPRIME; j++){
      max_exp[j] = std::max(max_exp[j], tmp_array[j]);
    }
  }

  std::cerr << "max_exp: " << std::endl;
  for(long long int j = 0; j < std::min((long long int)10, NPRIME); j++){
    std::cerr << max_exp[j] << " ";
  }std::cerr << "..." << std::endl;

  // calculate powertable
  std::vector<std::vector<long long int> > power_table(NPRIME);
  for(long long int i = 0; i < NPRIME; i++){
    power_table[i].push_back(1);
    for(long long int j = 1; j <= max_exp[i]; j++){
      power_table[i].push_back((power_table[i][j-1]*prime2[i] + MOD)%MOD);
    }
  }

  // calculate answer
  long long int ans = 0, Btmp;
  std::vector<long long int> B;

  for(long long int i = 0; i < N; i++){

    // prime factorize A[i]
    for(long long int j = 0; j < NPRIME; j++)tmp_array[j] = 0;

    Atmp = A[i];
    for(long long int j = 0; j < NPRIME && prime2[j]*prime2[j] <= A[i]; j++){
      while(Atmp %prime2[j] == 0){
        Atmp /=prime2[j];
        tmp_array[j]++;
      }
      if(Atmp == 1)break;
    }
    if(Atmp > 1){
      tmp_array[prime1[Atmp]]++;
    }
    // calculate B[i]
    Btmp = 1;
    for(long long int j = 0; j < NPRIME; j++){
      Btmp *= power_table[j][max_exp[j] - tmp_array[j]];
      Btmp = (Btmp+MOD)%MOD;
    }
    B.push_back(Btmp);
    ans += Btmp;
    ans = (ans+MOD)%MOD;
    //std::cerr << i << " " << tmp_array[0] << tmp_array[1] << " "<< Btmp << std::endl;
  }

  std::cerr << "answer: " << std::endl;
  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 17524