#include <bits/stdc++.h>
using namespace std;
long long int fast(long long int n, long long int a, long long int m) {
  if (n == 0)
    return 1;
  else if (n == 1)
    return a % m;
  else {
    long long int p = fast(n / 2, a, m) % m;
    p = ((p % m) * (p % m)) % m;
    if (n % 2 == 0)
      return (p % m);
    else
      return (((p % m) * (a % m)) % m);
  }
}
long long int isprime(long long int N) {
  if (N == 1 || N == 0)
    return 0;
  else if (N == 2 || N == 3)
    return 1;
  else if (N % 2 == 0 || N % 3 == 0)
    return 0;
  else {
    for (long long int i = 5; i * i <= N; i += 6) {
      if (N % i == 0 || N % (i + 2) == 0) return 0;
    }
    return 1;
  }
}
int b[1000001] = {0}, cnt[1000001] = {0};
long long int ans[1000001] = {0};
int main() {
  int n, i, j;
  cin >> n;
  int A[n], maxp = 0;
  for (i = 0; i < n; i++) {
    cin >> A[i];
    b[A[i]]++;
    maxp = max(maxp, A[i]);
  }
  for (i = 2; i <= maxp; i++) {
    for (j = i; j <= maxp; j += i) {
      cnt[i] += b[j];
    }
  }
  for (i = 2; i <= maxp; i++) {
    if (cnt[i] != 0) {
      ans[i] = ((cnt[i] % 1000000007) *
                (fast(cnt[i] - 1, 2, 1e9 + 7) % 1000000007)) %
               1000000007;
    }
  }
  for (i = maxp; i >= 1; i--) {
    for (j = i * 2; j <= maxp; j += i) {
      ans[i] -= ans[j];
      if (ans[i] < 0) {
        ans[i] += 1000000007;
        ans[i] %= 1000000007;
      }
    }
  }
  long long int res = 0;
  for (i = 2; i <= maxp; i++) {
    res = (res % 1000000007 + (i * ans[i]) % 1000000007) % 1000000007;
  }
  cout << res;
}
