
mod=10**9+7
n=int(input())
x=list(map(int,input().split()))

kai=1
for i in range(1,n):
    kai*=i

a=[]
for i in range(n-1):
    a.append(x[i+1]-x[i])
ans=0
a1=sum(a)
for i in range(n-1):
    ans+=a1+sum(a[0:i])
print(int(ans/(n-1)*kai%mod))