import math
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])

f=math.factorial(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)
