#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 7;
const int MOD = 1e9 + 7;
int E[MAX];
void euler() {
  E[1] = 1;
  for (int i = 2; i < MAX; i++) {
    if (!E[i])
      for (int j = i; j < MAX; j += i) {
        if (!E[j]) E[j] = j;
        E[j] = E[j] / i * (i - 1);
      }
  }
}
int n;
int a[MAX], cnt[MAX];
vector<int> G[MAX];
int main() {
  ios::sync_with_stdio(false), cin.tie(NULL);
  euler();
  for (int i = 1; i <= 100000; i++)
    for (int j = 1; j <= sqrt(i); j++)
      if (i % j == 0) {
        G[i].push_back(j);
        if (j * j != i) G[i].push_back(i / j);
      }
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    vector<int> v;
    for (int j = i; j <= n; j += i) {
      for (int k : G[a[j]]) {
        if (!cnt[k]) v.push_back(k);
        cnt[k]++;
      }
    }
    for (int j : v) {
      ans += 1ll * E[i] * E[j] % MOD * cnt[j] % MOD * cnt[j] % MOD, ans %= MOD;
      cnt[j] = 0;
    }
  }
  cout << ans << '\n';
  return 0;
}

### Prompt

Your task is to create a CPP solution to 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;
const int MAX = 1e5 + 7;
const int MOD = 1e9 + 7;
int E[MAX];
void euler() {
  E[1] = 1;
  for (int i = 2; i < MAX; i++) {
    if (!E[i])
      for (int j = i; j < MAX; j += i) {
        if (!E[j]) E[j] = j;
        E[j] = E[j] / i * (i - 1);
      }
  }
}
int n;
int a[MAX], cnt[MAX];
vector<int> G[MAX];
int main() {
  ios::sync_with_stdio(false), cin.tie(NULL);
  euler();
  for (int i = 1; i <= 100000; i++)
    for (int j = 1; j <= sqrt(i); j++)
      if (i % j == 0) {
        G[i].push_back(j);
        if (j * j != i) G[i].push_back(i / j);
      }
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    vector<int> v;
    for (int j = i; j <= n; j += i) {
      for (int k : G[a[j]]) {
        if (!cnt[k]) v.push_back(k);
        cnt[k]++;
      }
    }
    for (int j : v) {
      ans += 1ll * E[i] * E[j] % MOD * cnt[j] % MOD * cnt[j] % MOD, ans %= MOD;
      cnt[j] = 0;
    }
  }
  cout << ans << '\n';
  return 0;
}

```