#include <bits/stdc++.h>
using namespace std;
long long a[1000005];
long long num[1000005];
long long val[1000005];
long long modexp(long long a, long long b) {
  long long res = 1;
  if (b == 0) {
    return 1;
  }
  while (b) {
    if (b % 2) res = (res * a) % 1000000007;
    a = (a * a) % 1000000007;
    b /= 2;
  }
  return res;
}
void fac(long long nu) {
  long long i;
  for (i = 1; i * i < nu; i++) {
    if (nu % i == 0) {
      num[i]++;
      num[nu / i]++;
    }
  }
  if (i * i == nu) {
    num[i]++;
  }
}
signed main() {
  long long i, j, k, l, m, n, t;
  t = 1;
  while (t--) {
    cin >> n;
    for (i = 0; i < n; i++) {
      scanf("%lld", &a[i]);
      fac(a[i]);
    }
    for (i = 0; i <= 1000000; i++) {
      val[i] = (1LL * num[i] * modexp(2, num[i] - 1)) % 1000000007;
    }
    for (i = 1000000; i >= 2; i--) {
      if (num[i] == 0) continue;
      for (j = 2 * i; j <= 1000000; j += i) {
        val[i] -= val[j];
        if (val[i] < 0) {
          val[i] += 1000000007;
        }
      }
    }
    long long an = 0;
    for (i = 2; i <= 1000000; i++) {
      an += (1LL * val[i] * i) % 1000000007;
      an %= 1000000007;
    }
    printf("%lld\n", an);
  }
}
