#include <bits/stdc++.h>
using namespace std;
vector<int> v[100001];
const int skc = 1e9 + 7;
int n, a[100001], i, j, k, x, u[100001], p[100001];
long long ans, sum, cnt[100001];
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    for (j = 1; j * j <= a[i]; j++)
      if (a[i] % j == 0) {
        v[i].push_back(j);
        if (j * j != a[i]) v[i].push_back(a[i] / j);
      }
  }
  for (i = 1; i <= 100000; i++) {
    x = i;
    u[i] = i;
    for (j = 2; j * j <= x; j++)
      if (x % j == 0) {
        u[i] = u[i] / j * (j - 1);
        while (x % j == 0) x /= j;
      }
    if (x != 1) u[i] = u[i] / x * (x - 1);
  }
  for (i = 1; i <= n; i++) {
    sum = 0;
    for (j = i; j <= n; j += i) p[a[j]]++;
    for (j = i; j <= n; p[a[j]] = 0, j += i)
      if (p[a[j]])
        for (k = 0; k < v[j].size(); k++)
          x = v[j][k],
          sum = (sum -
                 (cnt[x] * cnt[x] - (cnt[x] + p[a[j]]) * (cnt[x] + p[a[j]])) %
                     skc * u[x]) %
                skc,
          cnt[x] += p[a[j]];
    for (j = i; j <= n; j += i) p[a[j]]++;
    for (j = i; j <= n; p[a[j]] = 0, j += i)
      for (k = 0; k < v[j].size(); k++) x = v[j][k], cnt[x] -= p[a[j]];
    ans = (ans + sum * u[i]) % skc;
  }
  printf("%lld\n", (ans + skc) % skc);
}

### Prompt

In CPP, your task is to solve 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;
vector<int> v[100001];
const int skc = 1e9 + 7;
int n, a[100001], i, j, k, x, u[100001], p[100001];
long long ans, sum, cnt[100001];
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    for (j = 1; j * j <= a[i]; j++)
      if (a[i] % j == 0) {
        v[i].push_back(j);
        if (j * j != a[i]) v[i].push_back(a[i] / j);
      }
  }
  for (i = 1; i <= 100000; i++) {
    x = i;
    u[i] = i;
    for (j = 2; j * j <= x; j++)
      if (x % j == 0) {
        u[i] = u[i] / j * (j - 1);
        while (x % j == 0) x /= j;
      }
    if (x != 1) u[i] = u[i] / x * (x - 1);
  }
  for (i = 1; i <= n; i++) {
    sum = 0;
    for (j = i; j <= n; j += i) p[a[j]]++;
    for (j = i; j <= n; p[a[j]] = 0, j += i)
      if (p[a[j]])
        for (k = 0; k < v[j].size(); k++)
          x = v[j][k],
          sum = (sum -
                 (cnt[x] * cnt[x] - (cnt[x] + p[a[j]]) * (cnt[x] + p[a[j]])) %
                     skc * u[x]) %
                skc,
          cnt[x] += p[a[j]];
    for (j = i; j <= n; j += i) p[a[j]]++;
    for (j = i; j <= n; p[a[j]] = 0, j += i)
      for (k = 0; k < v[j].size(); k++) x = v[j][k], cnt[x] -= p[a[j]];
    ans = (ans + sum * u[i]) % skc;
  }
  printf("%lld\n", (ans + skc) % skc);
}

```