#include <bits/stdc++.h>
using namespace std;
const int N = 2e5, A = 1e6, M = 1e9 + 7;
int g[A + 1], c[A + 1], p[N + 1];
int64_t ans;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    for (int b = 1; b * b <= a; b++)
      if (a % b == 0) g[b]++, g[a / b] += (a / b != b);
  }
  for (int i = 1, b = 1; i <= n; i++) p[i] = 1ll * b * i % M, b = b * 2 % M;
  for (int i = 2; i <= A; i++) {
    c[i] += i;
    for (int j = i + i; j <= A; j += i) c[j] -= c[i];
  }
  for (int i = 2; i <= A; i++)
    if (g[i]) ans += 1ll * c[i] * p[g[i]], ans %= M;
  cout << ans;
}
