#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
const long long mod = 1e9 + 7;
long long cnt[N], ans[N], p[N];
long long fun(long long x) {
  if (!x) return 0;
  return x * p[x - 1];
}
int main() {
  long long n;
  cin >> n;
  for (int x, i = 0; i < n; i++) cin >> x, cnt[x]++;
  cnt[0] = cnt[1] = ans[0] = ans[1] = 0;
  for (int i = 2; i < N; i++) {
    for (int j = i + i; j < N; j += i) {
      cnt[i] += cnt[j];
    }
  }
  p[0] = 1;
  for (int i = 1; i < N; i++) p[i] = (2 * p[i - 1]) % mod;
  long long final_ans = 0;
  for (int i = N - 1; i > 1; i--) {
    if (cnt[i] == 0) continue;
    ans[i] = (p[cnt[i] - 1] * cnt[i]) % mod;
    for (int j = i + i; j < N; j += i) {
      ans[i] = (((ans[i] - ans[j]) % mod) + mod) % mod;
    }
    final_ans = (final_ans + i * ans[i]) % mod;
  }
  cout << final_ans << '\n';
  return 0;
}
