MOD=10**9+7
n=int(input())
li=list(map(int,input().split()))
dist=[]
for i in range(n-1):
  dist.append(li[i+1]-li[i])  
  

fact=[-1]*(10**5+10)
fact[0]=1
for i in range(1,10**5+10):
  fact[i]=fact[i-1]*i%MOD


f=fact[(n-1)]
sum=0.0
ss=0
for i in range(1,n-1+1):
  ss+=f/i
  sum+=ss*dist[i-1]%MOD
ans=int(sum%MOD)
print(ans)
