#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long pow_2[1000001];
bool is_comp[1000001];
vector<long long> primes;
void pow_2_calc(long long maxe) {
  long long cur = 1;
  for (long long i = 0; i < maxe + 1; i++) {
    pow_2[i] = cur;
    cur *= 2;
    cur %= MOD;
  }
}
void calc_primes(long long maxe) {
  primes.push_back(1);
  for (long long prime = 2; prime < maxe + 1; prime++) {
    if (is_comp[prime]) continue;
    primes.push_back(prime);
    for (long long div = 2; div * prime <= maxe; div++) {
      is_comp[div * prime] = true;
    }
  }
}
long long f(long long n) { return (n * pow_2[n - 1]) % MOD; }
int main() {
  int n;
  cin >> n;
  vector<long long> v(n);
  long long maxi = -1;
  for (auto &x : v) {
    cin >> x;
    maxi = max(maxi, x);
  }
  pow_2_calc(maxi);
  calc_primes(maxi);
  vector<long long> divs(maxi + 1, 0);
  for (auto &x : v) {
    for (long long i = 2; i * i <= x; i++) {
      if (x % i == 0) {
        divs[i]++;
        if (x / i != i) divs[x / i]++;
      }
    }
    divs[x]++;
  }
  long long ans = 0;
  for (long long gcd = 2; gcd <= maxi; gcd++) {
    long long sub_ans = 0;
    vector<pair<long long, int>> cur_primes;
    if (divs[gcd] == 0) continue;
    cur_primes.push_back(make_pair(gcd, 0));
    sub_ans += f(divs[gcd]);
    sub_ans %= MOD;
    bool neg = true;
    while (!cur_primes.empty()) {
      vector<pair<long long, int>> new_primes;
      for (auto &x : cur_primes) {
        long long cur = x.first;
        for (int i = x.second + 1; i < primes.size(); i++) {
          if (primes[i] * cur > maxi)
            break;
          else {
            new_primes.push_back(make_pair(cur * primes[i], i));
            if (neg) {
              sub_ans -= f(divs[cur * primes[i]]);
            } else {
              sub_ans += f(divs[cur * primes[i]]);
            }
            sub_ans %= MOD;
          }
        }
      }
      cur_primes = new_primes;
      neg = !neg;
    }
    ans += gcd * sub_ans;
    ans %= MOD;
  }
  cout << ans << '\n';
  return 0;
}
