# coding: utf-8
import re
import math
import fractions
#import numpy as np
inf =int(10**20)
mod=int(10**9+7)
#main
n=int(input())
fac=math.factorial(n-1)%mod
X=list(map(int,input().split()))
A=[X[a+1]-X[a] for a in range(n-1)]
C=[0 for a in range(n-1)]
ans=0
for a in range(n-1):
    len=a+1
    if a==0:
        C[a]=1
        ans+=C[a]*A[a]
    else:
        C[a]=(1/len)*(1+C[a-1])+((len-1)/len)*C[a-1]
        ans+=C[a]*A[a]
    ans%=mod
ans*=fac
ans%=mod
print(int(ans))