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

MAXN = N+5
fac = [1,1] + [0]*MAXN
finv = [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
    finv[i] = finv[i-1] * inv[i] % MOD

c = 0
f = fac[N-1]
ans = 0
for i in range(1,N):
    c += f * inv[i]
    c %= MOD
    ans += c * (X[i] - X[i-1])
    ans %= MOD
print(ans)
