#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
mt19937_64 rnd64(
    chrono::high_resolution_clock::now().time_since_epoch().count());
long long power(long long a, long long m, long long mod) {
  long long ans = 1;
  while (m) {
    if (m % 2) ans *= a, ans %= (mod);
    a = (a * a) % (mod);
    m >>= 1;
  }
  return ans;
}
void init(long long* a, long long n, long long val) {
  for (long long i = 0; i < n; i++) a[i] = val;
}
long long ans[1000001];
void solve() {
  long long i, j, _;
  long long n;
  cin >> n;
  long long a;
  while (n--) {
    cin >> a;
    for (j = 1; j * j < a; ++j) {
      if (a % j == 0) {
        ans[j]++;
        ans[a / j]++;
      }
    }
    if (j > 1 && j * j == a) ans[j]++;
  }
  long long tot = 0;
  for (i = 1000000; i > 1; i--) {
    if (ans[i])
      ans[i] = (ans[i] * power(2, ans[i] - 1, 1000000007)) % 1000000007;
    for (j = 2 * i; j < 1000001; j += i) ans[i] -= ans[j], ans[i] %= 1000000007;
    ans[i] += 1000000007;
    ans[i] %= 1000000007;
    tot += (ans[i] * i) % 1000000007;
    tot %= 1000000007;
  }
  cout << tot << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
