#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000;
const int maxx = 200000;
const long long modd = 1e9 + 7;
long long a[maxn + 5];
long long b[maxn + 5];
long long pre[maxx + 5];
void init() {
  long long x = 1;
  for (int i = 1; i <= maxx; i++) {
    pre[i] = i * x % modd;
    x = x * 2 % modd;
  }
}
int main() {
  init();
  int n, x, M = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    a[x]++;
    if (x > M) M = x;
  }
  long long res = 0;
  for (int i = 2; i <= M; i++) {
    int cnt = 0;
    b[i] += i;
    for (int j = i; j <= M; j += i) {
      cnt += a[j];
      if (j != i) b[j] -= b[i];
    }
    res = (res + pre[cnt] * b[i]) % modd;
  }
  printf("%I64d\n", res);
  return 0;
}
