#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:36777216")
using namespace std;
long long mod = 1e9 + 7;
long double eps = 1e-12;
long double pi = acosl(-1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ifstream in("input.txt");
ofstream out("output.txt");
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using uc = unsigned char;
using us = unsigned short;
ll phi[100050];
ll a[100050];
vector<int> g[100050];
int used[100050];
int step = 1;
void solve() {
  phi[1] = 1;
  g[1].push_back(1);
  for (int i = 2; i < 100050; i++) {
    phi[i] = i - 1;
    g[i].push_back(1);
    g[i].push_back(i);
  }
  for (ll i = 2; i < 100050; i++) {
    for (ll j = 2; j * i < 100050; j++) {
      phi[j * i] -= phi[i];
      g[i * j].push_back(j);
    }
  }
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  ll ans = 0;
  for (ll i = 1; i <= n; i++) {
    ll res = 0;
    ll p = 1;
    unordered_map<int, ll> m;
    for (ll t = 1; t * i <= n; t++) {
      for (auto x : g[a[t * i]]) m[x]++;
    }
    for (auto x : m) {
      res += (((x.second * x.second) % mod) * phi[x.first]) % mod;
      if (res >= mod) res -= mod;
    }
    ans += res * phi[i] % mod;
    if (ans >= mod) ans -= mod;
  }
  cout << ans;
}
int main() {
  cout << setprecision(20) << fixed;
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  clock_t t1 = clock();
  ;
  int t = 1;
  int cs = 1;
  while (t--) {
    solve();
  }
  return 0;
}

### Prompt

Please provide a Cpp coded solution to the problem described below:

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>
#pragma comment(linker, "/STACK:36777216")
using namespace std;
long long mod = 1e9 + 7;
long double eps = 1e-12;
long double pi = acosl(-1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ifstream in("input.txt");
ofstream out("output.txt");
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using uc = unsigned char;
using us = unsigned short;
ll phi[100050];
ll a[100050];
vector<int> g[100050];
int used[100050];
int step = 1;
void solve() {
  phi[1] = 1;
  g[1].push_back(1);
  for (int i = 2; i < 100050; i++) {
    phi[i] = i - 1;
    g[i].push_back(1);
    g[i].push_back(i);
  }
  for (ll i = 2; i < 100050; i++) {
    for (ll j = 2; j * i < 100050; j++) {
      phi[j * i] -= phi[i];
      g[i * j].push_back(j);
    }
  }
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  ll ans = 0;
  for (ll i = 1; i <= n; i++) {
    ll res = 0;
    ll p = 1;
    unordered_map<int, ll> m;
    for (ll t = 1; t * i <= n; t++) {
      for (auto x : g[a[t * i]]) m[x]++;
    }
    for (auto x : m) {
      res += (((x.second * x.second) % mod) * phi[x.first]) % mod;
      if (res >= mod) res -= mod;
    }
    ans += res * phi[i] % mod;
    if (ans >= mod) ans -= mod;
  }
  cout << ans;
}
int main() {
  cout << setprecision(20) << fixed;
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  clock_t t1 = clock();
  ;
  int t = 1;
  int cs = 1;
  while (t--) {
    solve();
  }
  return 0;
}

```