N=int(input())
X=list(map(int,input().split()))
MOD=10**9+7

facN_1=1
suminv=[1]*N
inv=[1]*N
for i in range(2,N):
    facN_1=facN_1*i%MOD
    inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
    suminv[i]=(suminv[i-1]+inv[i])%MOD

ans=0
for i in range(N-1):
    tmp=X[i+1]-X[i]
    tmp*=suminv[i+1]%MOD
    ans+=tmp
    ans%=MOD
print(ans*facN_1%MOD)
