#include <bits/stdc++.h>
using namespace std;
template <typename T>
void _do(vector<T> x) {
  for (auto i : x) cerr << i << ' ';
  cerr << "\n";
}
template <typename T>
void _do(set<T> x) {
  for (auto i : x) cerr << i << ' ';
  cerr << "\n";
}
template <typename T>
void _do(unordered_set<T> x) {
  for (auto i : x) cerr << i << ' ';
  cerr << "\n";
}
template <typename T>
void _do(T&& x) {
  cerr << x << endl;
}
template <typename T, typename... S>
void _do(T&& x, S&&... y) {
  cerr << x << ", ";
  _do(y...);
}
template <typename T>
void print(T&& x) {
  cout << x << "\n";
}
template <typename T, typename... S>
void print(T&& x, S&&... y) {
  cout << x << ' ';
  print(y...);
}
void solve() {
  const int M = 1e5 + 1, MOD = 1e9 + 7;
  vector<int> mu(M, -2);
  vector<int> primes;
  mu[1] = 1;
  for (int i = 2; i < M; i++) {
    if (mu[i] == -2) {
      primes.push_back(i);
      mu[i] = -1;
    }
    for (int p : primes) {
      if (1LL * i * p >= M) break;
      if (i % p == 0) {
        mu[i * p] = 0;
        break;
      }
      mu[i * p] = -mu[i];
    }
  }
  vector<int> f(M);
  for (int i = 1; i < M; i++)
    for (int d = 1; i * d < M; d++) f[i * d] = (f[i * d] + mu[d] * i) % MOD;
  int n;
  cin >> n;
  vector<vector<int>> fac(n + 1);
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    for (int j = 1; 1LL * j * j <= a; j++)
      if (a % j == 0) {
        fac[i].push_back(j);
        if (j * j != a) fac[i].push_back(a / j);
      }
  }
  vector<int> cnt(M);
  int ans = 0;
  for (int T = 1; T <= n; T++) {
    int G = 0;
    vector<int> vec;
    for (int i = 1; i * T <= n; i++) {
      for (int p : fac[i * T])
        if (cnt[p]++ == 0) vec.push_back(p);
    }
    for (int p : vec) G = (G + 1LL * f[p] * cnt[p] % MOD * cnt[p]) % MOD;
    for (int i = 1; i * T <= n; i++) {
      for (int p : fac[i * T]) cnt[p]--;
    }
    ans = (ans + 1LL * G * f[T]) % MOD;
  }
  if (ans < 0) ans += MOD;
  cout << ans << endl;
}
int main() {
  cin.tie(0), cout.tie(0);
  ios::sync_with_stdio(false);
  solve();
}

### Prompt

Create a solution in CPP for the following problem:

Mr. Chanek has an array a of n integers. The prettiness value of a is denoted as:

$$$∑_{i=1}^{n} {∑_{j=1}^{n} {\gcd(a_i, a_j) ⋅ \gcd(i, j)}}$$$

where \gcd(x, y) denotes the greatest common divisor (GCD) of integers x and y.

In other words, the prettiness value of an array a is the total sum of \gcd(a_i, a_j) ⋅ \gcd(i, j) for all pairs (i, j).

Help Mr. Chanek find the prettiness value of a, and output the result modulo 10^9 + 7!

Input

The first line contains an integer n (2 ≤ n ≤ 10^5).

The second line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^5).

Output

Output an integer denoting the prettiness value of a modulo 10^9 + 7.

Example

Input


5
3 6 2 1 4


Output


77

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <typename T>
void _do(vector<T> x) {
  for (auto i : x) cerr << i << ' ';
  cerr << "\n";
}
template <typename T>
void _do(set<T> x) {
  for (auto i : x) cerr << i << ' ';
  cerr << "\n";
}
template <typename T>
void _do(unordered_set<T> x) {
  for (auto i : x) cerr << i << ' ';
  cerr << "\n";
}
template <typename T>
void _do(T&& x) {
  cerr << x << endl;
}
template <typename T, typename... S>
void _do(T&& x, S&&... y) {
  cerr << x << ", ";
  _do(y...);
}
template <typename T>
void print(T&& x) {
  cout << x << "\n";
}
template <typename T, typename... S>
void print(T&& x, S&&... y) {
  cout << x << ' ';
  print(y...);
}
void solve() {
  const int M = 1e5 + 1, MOD = 1e9 + 7;
  vector<int> mu(M, -2);
  vector<int> primes;
  mu[1] = 1;
  for (int i = 2; i < M; i++) {
    if (mu[i] == -2) {
      primes.push_back(i);
      mu[i] = -1;
    }
    for (int p : primes) {
      if (1LL * i * p >= M) break;
      if (i % p == 0) {
        mu[i * p] = 0;
        break;
      }
      mu[i * p] = -mu[i];
    }
  }
  vector<int> f(M);
  for (int i = 1; i < M; i++)
    for (int d = 1; i * d < M; d++) f[i * d] = (f[i * d] + mu[d] * i) % MOD;
  int n;
  cin >> n;
  vector<vector<int>> fac(n + 1);
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    for (int j = 1; 1LL * j * j <= a; j++)
      if (a % j == 0) {
        fac[i].push_back(j);
        if (j * j != a) fac[i].push_back(a / j);
      }
  }
  vector<int> cnt(M);
  int ans = 0;
  for (int T = 1; T <= n; T++) {
    int G = 0;
    vector<int> vec;
    for (int i = 1; i * T <= n; i++) {
      for (int p : fac[i * T])
        if (cnt[p]++ == 0) vec.push_back(p);
    }
    for (int p : vec) G = (G + 1LL * f[p] * cnt[p] % MOD * cnt[p]) % MOD;
    for (int i = 1; i * T <= n; i++) {
      for (int p : fac[i * T]) cnt[p]--;
    }
    ans = (ans + 1LL * G * f[T]) % MOD;
  }
  if (ans < 0) ans += MOD;
  cout << ans << endl;
}
int main() {
  cin.tie(0), cout.tie(0);
  ios::sync_with_stdio(false);
  solve();
}

```