#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vb = vector<bool>;
using vs = vector<string>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;
const ll MOD = 1000000007;
ll modExp(ll a, ll x, ll m = MOD) {
  if (x == 0) return 1;
  ll res = modExp(a, x / 2, m);
  res = (res * res) % m;
  return (x % 2) ? (res * a) % m : res;
}
ll sum(ll n) { return ((n % MOD) * modExp(2ll, n - 1)) % MOD; }
int main() {
  cin.sync_with_stdio(0);
  ll n;
  cin >> n;
  vl as(n);
  for (ll i = (0); i < (n); i++) {
    cin >> as[i];
  }
  const ll MAX = 1e6 + 10;
  vl cnt(MAX);
  for (ll j = (0); j < (n); j++) {
    for (ll i = 1; i * i <= as[j]; i++) {
      if (as[j] % i == 0) {
        cnt[i]++;
        if (i != as[j] / i) cnt[as[j] / i]++;
      }
    }
  }
  ll out = 0;
  vl ans(MAX);
  for (ll d = ll(MAX) - 1; d >= (2); d--) {
    if (!cnt[d]) continue;
    ll res = sum(cnt[d]) % MOD;
    ({
      if (0) cerr << "TR: " << ("d") << " = " << (d) << endl;
    });
    ({
      if (0) cerr << "TR: " << ("cnt[d]") << " = " << (cnt[d]) << endl;
    });
    ({
      if (0) cerr << "TR: " << ("res") << " = " << (res) << endl;
    });
    for (ll d2 = d + d; d2 < MAX; d2 += d) {
      res -= ans[d2];
      res = res % MOD;
      if (res < 0) res += MOD;
    }
    ans[d] = res % MOD;
    out = (out + ((d * ans[d]) % MOD)) % MOD;
  }
  cout << out << endl;
}
