nnnnn = 101010
P = 10**9+7

fa = [1]
for i in range(1, nnnnn):
    fa.append(fa[-1] * i % P)
fainv = [pow(fa[-1], P-2, P)]
for i in range(1, nnnnn)[::-1]:
    fainv.append(fainv[-1] * i % P)
fainv = fainv[::-1]

N = int(input())
A = [int(a) for a in input().split()]
B = [A[i+1] - A[i] for i in range(N-1)]
S = [0]
for i in range(1, N):
    S.append((S[-1] + fainv[i] * fa[i-1]) % P)

ans = 0
for i in range(N-1):
    ans = (ans + B[i] * S[i+1]) % P

print(ans * fa[N-1] % P)

