N = int(input())
X = list(map(int,input().split()))
Y = [b-a for a,b in zip(X,X[1:])]

MOD = 10**9+7
MAXN = N+5
fac = [1,1] + [0]*MAXN
inv = [0,1] + [0]*MAXN
for i in range(2,MAXN+2):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = -inv[MOD%i] * (MOD // i) % MOD

ans = m = 0
for i,y in enumerate(Y):
    m += fac[N-1] * inv[i+1]
    ans += y*m
    ans %= MOD
print(ans)