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
#include<bits/stdc++.h>
#define I inline
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(x) ((x)>0?(x):-(x))
#define re register
#define RI re int
#define ll long long
#define db double
#define lb long db
#define N 100000
#define M 5
#define mod 1000000007
#define Mod 998244352
#define eps (1e-4)
#define U unsigned int
#define it iterator
#define Gc() getchar() 
#define Me(x,y) memset(x,y,sizeof(x))
#define d(x,y) (n*(x-1)+(y))
#define R(n) (rand()*rand()%(n)+1)
using namespace std;
int n,k,pr[N+5],ph,Fl[N+5],mu[N+5],A[N+5],B[N+5],Bh,S[N+5],Maxn,F[N+5];ll Ans,ToT,Pus;
I ll Solve1(int x){
	Me(S,0);RI i,j;for(i=x;i<=n;i+=x) S[A[i]]++;
	ToT=0;for(i=1;i<=Maxn;i++){
		for(Pus=0,j=i;j<=Maxn;j+=i)Pus+=S[j];ToT+=Pus*Pus*F[i];
	}return ToT%mod;
}
I ll Solve2(int x){
	RI i,j;ToT=0;Bh=0;for(i=x;i<=n;i+=x) B[++Bh]=A[i];for(i=1;i<=Bh;i++) for(j=1;j<=Bh;j++) ToT+=__gcd(B[i],B[j]);return ToT%mod;
}
int main(){
//	freopen("1.in","r",stdin);
	RI i,j;scanf("%d",&n);k=pow(n,0.66);for(i=1;i<=n;i++) scanf("%d",&A[i]),Maxn=max(Maxn,A[i]);
	for(mu[1]=1,i=2;i<=Maxn;i++){
		!Fl[i]&&(mu[i]=-1,pr[++ph]=i);for(j=1;j<=ph&&i*pr[j]<=Maxn;j++){
			Fl[i*pr[j]]=1;if(i%pr[j]==0)break;mu[i*pr[j]]=-mu[i];
		}
	}
	for(i=1;i<=Maxn;i++) for(j=i;j<=Maxn;j+=i) F[j]+=mu[j/i]*i;
	for(i=1;i<=n;i++) {
		if(i<=k) Ans+=Solve1(i)*F[i]%mod;
		else Ans+=Solve2(i)*F[i]%mod;//printf(" %lld\n",Ans);
	}printf("%lld\n",(Ans%mod+mod)%mod);
}