#include <bits/stdc++.h>
using namespace std;
void per() { cerr << endl; }
template <typename Head, typename... Tail>
void per(Head H, Tail... T) {
  cerr << H << ' ';
  per(T...);
}
template <class T>
bool uin(T& a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T& a, T b) {
  return a < b ? (a = b, true) : false;
}
template <class U, class V>
ostream& operator<<(ostream& out, const pair<U, V>& a) {
  return out << "(" << a.first << ", " << a.second << ")";
}
template <class U, class V>
istream& operator>>(istream& in, pair<U, V>& a) {
  return in >> a.first >> a.second;
}
template <typename W,
          typename T = typename enable_if<!is_same<W, string>::value,
                                          typename W::value_type>::type>
ostream& operator<<(ostream& out, const W& v) {
  out << "{ ";
  for (const auto& first : v) out << first << ", ";
  return out << '}';
}
template <class T>
void readArr(T from, T to) {
  for (auto i = from; i != to; ++i) cin >> *i;
}
mt19937 mrand(1337);
unsigned int myRand32() { return mrand() & (unsigned int)(-1); }
unsigned long long myRand64() {
  return ((unsigned long long)myRand32() << 32) ^ myRand32();
}
const int mod = 1000000007;
void add(int& a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
void dec(int& a, int b) {
  a -= b;
  if (a < 0) a += mod;
}
int mult(int a, int b) { return a * (long long)b % mod; }
int bp(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) res = mult(res, a);
    a = mult(a, a);
    b >>= 1;
  }
  return res;
}
const int N = 1e5 + 7;
vector<int> divs[N];
int phi[N];
int calc_phi(int n) {
  int result = n;
  for (int i = 2; i * i <= n; ++i)
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      result -= result / i;
    }
  if (n > 1) result -= result / n;
  return result;
}
void init() {
  for (int i = 1; i < N; ++i) {
    for (int j = 1; j * j <= i; ++j) {
      if (i % j == 0) {
        divs[i].push_back(j);
        if (j * j != i) divs[i].push_back(i / j);
      }
    }
    phi[i] = calc_phi(i);
  }
}
int cnt[N];
bool used[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  init();
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int res = 0;
  for (int first = 1; first <= n; ++first) {
    for (int pos = first; pos <= n; pos += first) {
      for (int d : divs[a[pos - 1]]) {
        ++cnt[d];
      }
    }
    for (int pos = first; pos <= n; pos += first) {
      for (int d : divs[a[pos - 1]]) {
        if (used[d]) continue;
        used[d] = true;
        int tet = cnt[d];
        int now = mult(phi[first], mult(phi[d], tet * (long long)tet % mod));
        add(res, now);
      }
    }
    for (int pos = first; pos <= n; pos += first) {
      for (int d : divs[a[pos - 1]]) {
        --cnt[d];
        used[d] = false;
      }
    }
  }
  cout << res << "\n";
}

### Prompt

Your challenge is to write 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;
void per() { cerr << endl; }
template <typename Head, typename... Tail>
void per(Head H, Tail... T) {
  cerr << H << ' ';
  per(T...);
}
template <class T>
bool uin(T& a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T& a, T b) {
  return a < b ? (a = b, true) : false;
}
template <class U, class V>
ostream& operator<<(ostream& out, const pair<U, V>& a) {
  return out << "(" << a.first << ", " << a.second << ")";
}
template <class U, class V>
istream& operator>>(istream& in, pair<U, V>& a) {
  return in >> a.first >> a.second;
}
template <typename W,
          typename T = typename enable_if<!is_same<W, string>::value,
                                          typename W::value_type>::type>
ostream& operator<<(ostream& out, const W& v) {
  out << "{ ";
  for (const auto& first : v) out << first << ", ";
  return out << '}';
}
template <class T>
void readArr(T from, T to) {
  for (auto i = from; i != to; ++i) cin >> *i;
}
mt19937 mrand(1337);
unsigned int myRand32() { return mrand() & (unsigned int)(-1); }
unsigned long long myRand64() {
  return ((unsigned long long)myRand32() << 32) ^ myRand32();
}
const int mod = 1000000007;
void add(int& a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
void dec(int& a, int b) {
  a -= b;
  if (a < 0) a += mod;
}
int mult(int a, int b) { return a * (long long)b % mod; }
int bp(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) res = mult(res, a);
    a = mult(a, a);
    b >>= 1;
  }
  return res;
}
const int N = 1e5 + 7;
vector<int> divs[N];
int phi[N];
int calc_phi(int n) {
  int result = n;
  for (int i = 2; i * i <= n; ++i)
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      result -= result / i;
    }
  if (n > 1) result -= result / n;
  return result;
}
void init() {
  for (int i = 1; i < N; ++i) {
    for (int j = 1; j * j <= i; ++j) {
      if (i % j == 0) {
        divs[i].push_back(j);
        if (j * j != i) divs[i].push_back(i / j);
      }
    }
    phi[i] = calc_phi(i);
  }
}
int cnt[N];
bool used[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  init();
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int res = 0;
  for (int first = 1; first <= n; ++first) {
    for (int pos = first; pos <= n; pos += first) {
      for (int d : divs[a[pos - 1]]) {
        ++cnt[d];
      }
    }
    for (int pos = first; pos <= n; pos += first) {
      for (int d : divs[a[pos - 1]]) {
        if (used[d]) continue;
        used[d] = true;
        int tet = cnt[d];
        int now = mult(phi[first], mult(phi[d], tet * (long long)tet % mod));
        add(res, now);
      }
    }
    for (int pos = first; pos <= n; pos += first) {
      for (int d : divs[a[pos - 1]]) {
        --cnt[d];
        used[d] = false;
      }
    }
  }
  cout << res << "\n";
}

```