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

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

