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
ss=0
for i in range(1,n):
  ss+=1/i
  sum+=ss*dist[i-1]
ans=int((sum*f)%MOD)


print(ans)


