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

perm = 1
for i in range(N-1):
    perm*=(i+1)

D = []
for i in range(N-1):
    D.append(X[i+1]-X[i])
    
p = 0
ans = 0
for i,d in enumerate(D):
    p+=(1/(i+1))
    ans+=d*p
    
print(int(ans*perm)%mod)
    

