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)

ss=0
rr=[]
for i in range(1,n):
  ss+=(f)//i
  rr.append(ss%MOD)

sum=0
for i,j in zip(dist,rr):
  sum+=i*j%MOD
ans=int((sum)%MOD)


print(ans)


