#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
vector<int> p;
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int a[100010], b[100010], c[100010], h[100010];
long long f[100010];
vector<int> m[100010], d[100010];
void calc(int x) {}
int main() {
  a[1] = 1;
  for (int i = 2; i <= 100000; i++) {
    if (a[i]) continue;
    p.push_back(i);
    for (int j = i + i; j <= 100000; j += i) {
      a[j] = 1;
      d[j].push_back(i);
    }
  }
  for (int i = 1; i <= 100000; i++) {
    h[i] = i;
  }
  for (int i = 1; i <= 100000; i++) {
    for (int j = i; j <= 100000; j += i) {
      m[j].push_back(i);
      if (!a[i]) h[j] = h[j] / i * (i - 1);
    }
  }
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b[i]);
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    vector<int> w;
    for (int j = i; j <= n; j += i) {
      for (int k = 0; k < m[b[j]].size(); k++) {
        int x = m[b[j]][k];
        if (!c[x]++) w.push_back(x);
      }
    }
    for (int j = 0; j < w.size(); j++) {
      int x = w[j];
      f[i] = (f[i] + 1ll * h[x] * c[x] * c[x]) % mod;
    }
    for (int j = 0; j < w.size(); j++) {
      c[w[j]] = 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    ans = (ans + f[i] * h[i]) % mod;
  }
  printf("%lld\n", ans);
  return 0;
}

### Prompt

Your challenge is to write 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 mod = 1000000007;
vector<int> p;
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int a[100010], b[100010], c[100010], h[100010];
long long f[100010];
vector<int> m[100010], d[100010];
void calc(int x) {}
int main() {
  a[1] = 1;
  for (int i = 2; i <= 100000; i++) {
    if (a[i]) continue;
    p.push_back(i);
    for (int j = i + i; j <= 100000; j += i) {
      a[j] = 1;
      d[j].push_back(i);
    }
  }
  for (int i = 1; i <= 100000; i++) {
    h[i] = i;
  }
  for (int i = 1; i <= 100000; i++) {
    for (int j = i; j <= 100000; j += i) {
      m[j].push_back(i);
      if (!a[i]) h[j] = h[j] / i * (i - 1);
    }
  }
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b[i]);
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    vector<int> w;
    for (int j = i; j <= n; j += i) {
      for (int k = 0; k < m[b[j]].size(); k++) {
        int x = m[b[j]][k];
        if (!c[x]++) w.push_back(x);
      }
    }
    for (int j = 0; j < w.size(); j++) {
      int x = w[j];
      f[i] = (f[i] + 1ll * h[x] * c[x] * c[x]) % mod;
    }
    for (int j = 0; j < w.size(); j++) {
      c[w[j]] = 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    ans = (ans + f[i] * h[i]) % mod;
  }
  printf("%lld\n", ans);
  return 0;
}

```