from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
#N=int(input())
#S=[list(map(int,input().split())) for i in range(N)]
N=int(input())
X=list(map(int,input().split()))
lastX=X.pop()
mod=10**9+7
ferumaC=10**5+1
fac=[1,1]
for i in range(2,ferumaC):
    fac.append(fac[i-1]*i%mod)
ipow=[pow(i,mod-2,mod) for i in range(ferumaC)]
count=0
for i in range(1,len(X)):
    count2=0
    for n in range(min(i,len(X)-i)):
        a=((len(X)-1)//i)*i+n
        if a>len(X)-1:
            a-=i
        #print(n,a,i)
        count2+=X[a]-X[n]
    count=(count+ipow[i+1]*ipow[i]*count2)%mod
for i in range(len(X)):
    count=(count+(lastX-X[i])*ipow[len(X)-i])%mod
count=count*fac[N-1]%mod
print(count)
