#include <bits/stdc++.h>
using namespace std;
const int MX = 100005;
const long long mod = 1e9 + 7;
int phi[MX];
void precalc_phi() {
  phi[0] = 0;
  phi[1] = 1;
  for (int i = 2; i < MX; i++) phi[i] = i;
  for (int i = 2; i < MX; i++)
    if (phi[i] == i)
      for (int j = i; j < MX; j += i) phi[j] -= phi[j] / i;
}
vector<int> d[MX];
void precalc_divisors() {
  for (int i = 1; i < MX; i++)
    for (int j = i; j < MX; j += i) d[j].push_back(i);
}
int n, arr[MX], cnt[MX];
int main() {
  cin.tie(0)->sync_with_stdio(0);
  precalc_phi();
  precalc_divisors();
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  long long ans = 0ll;
  for (int x = 1; x <= n; x++) {
    for (int i = x; i <= n; i += x)
      for (int j : d[arr[i]]) cnt[j]++;
    for (int i = x; i <= n; i += x)
      for (int j : d[arr[i]])
        if (cnt[j]) {
          (ans += phi[x] *
                  (phi[j] * 1ll * (cnt[j] * 1ll * cnt[j] % mod) % mod) % mod) %=
              mod;
          cnt[j] = 0;
        }
  }
  cout << ans << endl;
  return 0;
}

### Prompt

Create a solution in Cpp for 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 MX = 100005;
const long long mod = 1e9 + 7;
int phi[MX];
void precalc_phi() {
  phi[0] = 0;
  phi[1] = 1;
  for (int i = 2; i < MX; i++) phi[i] = i;
  for (int i = 2; i < MX; i++)
    if (phi[i] == i)
      for (int j = i; j < MX; j += i) phi[j] -= phi[j] / i;
}
vector<int> d[MX];
void precalc_divisors() {
  for (int i = 1; i < MX; i++)
    for (int j = i; j < MX; j += i) d[j].push_back(i);
}
int n, arr[MX], cnt[MX];
int main() {
  cin.tie(0)->sync_with_stdio(0);
  precalc_phi();
  precalc_divisors();
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  long long ans = 0ll;
  for (int x = 1; x <= n; x++) {
    for (int i = x; i <= n; i += x)
      for (int j : d[arr[i]]) cnt[j]++;
    for (int i = x; i <= n; i += x)
      for (int j : d[arr[i]])
        if (cnt[j]) {
          (ans += phi[x] *
                  (phi[j] * 1ll * (cnt[j] * 1ll * cnt[j] % mod) % mod) % mod) %=
              mod;
          cnt[j] = 0;
        }
  }
  cout << ans << endl;
  return 0;
}

```