#include <bits/stdc++.h>
using namespace std;
long long arr[1000005];
long long power[1000005], lol[1000005];
vector<long long int> v(1000005);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    power[0] = 1;
    for (long long int i = 1; i < 200001; i++)
      power[i] = (2 * power[i - 1]) % 1000000007;
    long long n;
    cin >> n;
    for (long long int _ = 1; _ < n + 1; _++) {
      long long x;
      cin >> x;
      lol[x]++;
    }
    for (long long int i = 1; i < 1000005; i++) {
      long long g = 0;
      for (long long j = i; j < 1000005; j += i) g += lol[j];
      if (g != 0) arr[i] = (g * power[g - 1]) % 1000000007;
    }
    for (long long i = 1000005 - 2; i >= 2; i--) {
      for (long long j = 2 * i; j < 1000005; j += i)
        arr[i] = (arr[i] + 1000000007 - arr[j]) % 1000000007;
    }
    long long ans = 0;
    for (long long int i = 2; i < 1000005; i++) {
      ans = (ans + (i * arr[i]) % 1000000007) % 1000000007;
    }
    cout << ans << '\n';
  }
  return 0;
}
