#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
const long long Inf = 1ll << 60ll;
namespace io {
char buf[(1 << 23)], *p1 = buf, *p2 = buf, c;
int f;
template <typename T>
T read() {
  T x = 0;
  f = 0;
  c = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, (1 << 23), stdin), p1 == p2)
           ? EOF
           : *p1++);
  while (!isdigit(c))
    (c == '-') && (f = 1),
        c = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, (1 << 23), stdin),
                          p1 == p2)
                 ? EOF
                 : *p1++);
  while (isdigit(c))
    x = x * 10 + (c & 15),
    c = (p1 == p2 &&
                 (p2 = (p1 = buf) + fread(buf, 1, (1 << 23), stdin), p1 == p2)
             ? EOF
             : *p1++);
  return f ? -x : x;
}
}  // namespace io
const int N = 100005;
const long long mod = 1000000007;
void reduce(int& x) { (x >= mod) && (x -= mod); }
int n, a[N], cnt[N], phi[N], ans;
vector<int> v, fac[N];
int main() {
  for (int i = 1; i <= 100000; ++i) phi[i] = i;
  for (int i = 1; i <= 100000; ++i)
    for (int j = 2; i * j <= 100000; ++j) phi[i * j] -= phi[i];
  for (int i = 1; i <= 100000; ++i)
    for (int j = 1; i * j <= 100000; ++j) fac[i * j].push_back(i);
  n = io::read<int>();
  for (int i = 1; i <= n; ++i) a[i] = io::read<int>();
  for (int d = 1; d <= n; ++d) {
    v.clear();
    for (int i = d; i <= n; i += d) {
      for (int f : fac[a[i]]) {
        if (cnt[f] == 0) v.push_back(f);
        ++cnt[f];
      }
    }
    for (int f : v) {
      reduce(ans += 1ll * phi[d] * phi[f] % mod * cnt[f] % mod * cnt[f] % mod);
      cnt[f] = 0;
    }
  }
  printf("%d\n", ans);
  return 0;
}

### Prompt

Please formulate 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 inf = 1 << 30;
const long long Inf = 1ll << 60ll;
namespace io {
char buf[(1 << 23)], *p1 = buf, *p2 = buf, c;
int f;
template <typename T>
T read() {
  T x = 0;
  f = 0;
  c = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, (1 << 23), stdin), p1 == p2)
           ? EOF
           : *p1++);
  while (!isdigit(c))
    (c == '-') && (f = 1),
        c = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, (1 << 23), stdin),
                          p1 == p2)
                 ? EOF
                 : *p1++);
  while (isdigit(c))
    x = x * 10 + (c & 15),
    c = (p1 == p2 &&
                 (p2 = (p1 = buf) + fread(buf, 1, (1 << 23), stdin), p1 == p2)
             ? EOF
             : *p1++);
  return f ? -x : x;
}
}  // namespace io
const int N = 100005;
const long long mod = 1000000007;
void reduce(int& x) { (x >= mod) && (x -= mod); }
int n, a[N], cnt[N], phi[N], ans;
vector<int> v, fac[N];
int main() {
  for (int i = 1; i <= 100000; ++i) phi[i] = i;
  for (int i = 1; i <= 100000; ++i)
    for (int j = 2; i * j <= 100000; ++j) phi[i * j] -= phi[i];
  for (int i = 1; i <= 100000; ++i)
    for (int j = 1; i * j <= 100000; ++j) fac[i * j].push_back(i);
  n = io::read<int>();
  for (int i = 1; i <= n; ++i) a[i] = io::read<int>();
  for (int d = 1; d <= n; ++d) {
    v.clear();
    for (int i = d; i <= n; i += d) {
      for (int f : fac[a[i]]) {
        if (cnt[f] == 0) v.push_back(f);
        ++cnt[f];
      }
    }
    for (int f : v) {
      reduce(ans += 1ll * phi[d] * phi[f] % mod * cnt[f] % mod * cnt[f] % mod);
      cnt[f] = 0;
    }
  }
  printf("%d\n", ans);
  return 0;
}

```