#include <bits/stdc++.h>
template <class T>
inline T read() {
  T r = 0, f = 0;
  char c;
  while (!isdigit(c = getchar())) f |= (c == '-');
  while (isdigit(c)) r = (r << 1) + (r << 3) + (c ^ 48), c = getchar();
  return f ? -r : r;
}
bool n_p[101101];
int s_p, p[101101], phi[101101];
std::vector<int> fact[101101];
inline void init(int n) {
  phi[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!n_p[i]) p[++s_p] = i, phi[i] = i - 1;
    for (int j = 1; j <= s_p && p[j] <= n / i; j++) {
      n_p[i * p[j]] = 1;
      if (!(i % p[j])) {
        phi[i * p[j]] = phi[i] * p[j];
        break;
      }
      phi[i * p[j]] = phi[i] * (p[j] - 1);
    }
  }
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j += i) fact[j].push_back(i);
}
int n, a[101101], cnt[101101];
int main() {
  n = read<int>();
  for (int i = 1; i <= n; i++) a[i] = read<int>();
  init(1e5);
  long long ans = 0;
  for (int d = 1; d <= n; d++) {
    long long s = 0;
    for (int i = d; i <= n; i += d)
      for (auto x : fact[a[i]]) {
        (s += 1ll * (2 * cnt[x] + 1) * phi[x]) %= 1000000007;
        cnt[x]++;
      }
    (ans += phi[d] * s) %= 1000000007;
    for (int i = d; i <= n; i += d)
      for (auto x : fact[a[i]]) cnt[x] = 0;
  }
  printf("%lld\n", ans);
  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>
template <class T>
inline T read() {
  T r = 0, f = 0;
  char c;
  while (!isdigit(c = getchar())) f |= (c == '-');
  while (isdigit(c)) r = (r << 1) + (r << 3) + (c ^ 48), c = getchar();
  return f ? -r : r;
}
bool n_p[101101];
int s_p, p[101101], phi[101101];
std::vector<int> fact[101101];
inline void init(int n) {
  phi[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!n_p[i]) p[++s_p] = i, phi[i] = i - 1;
    for (int j = 1; j <= s_p && p[j] <= n / i; j++) {
      n_p[i * p[j]] = 1;
      if (!(i % p[j])) {
        phi[i * p[j]] = phi[i] * p[j];
        break;
      }
      phi[i * p[j]] = phi[i] * (p[j] - 1);
    }
  }
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j += i) fact[j].push_back(i);
}
int n, a[101101], cnt[101101];
int main() {
  n = read<int>();
  for (int i = 1; i <= n; i++) a[i] = read<int>();
  init(1e5);
  long long ans = 0;
  for (int d = 1; d <= n; d++) {
    long long s = 0;
    for (int i = d; i <= n; i += d)
      for (auto x : fact[a[i]]) {
        (s += 1ll * (2 * cnt[x] + 1) * phi[x]) %= 1000000007;
        cnt[x]++;
      }
    (ans += phi[d] * s) %= 1000000007;
    for (int i = d; i <= n; i += d)
      for (auto x : fact[a[i]]) cnt[x] = 0;
  }
  printf("%lld\n", ans);
  return 0;
}

```