
import math
MOD=10**9+7


n=int(input())
li=list(map(int,input().split()))

rr=[]
for i in range(n-1):
    tmp=(li[i+1]-li[i])
    rr.append(tmp)

k=[]    
f=math.factorial(n-1)
ss=0
for i in range(1,n-1+1):
    ss+=1/i*f
    k.append(ss)
    




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


print(int(sum%MOD))