MOD = 10 ** 9 + 7
modinv = lambda a, mod=MOD: pow(a, mod - 2, mod)

N = int(input())
X = list(map(int, input().split()))
Acc = [X[-1] - X[i] for i in range(N - 2, -1, -1)]

fac = 1
for i in range(2, N):
    fac = (fac * i) % MOD
prob = [fac] * (N - 1)
for i in range(N - 1):
    prob[i] = (prob[i] * modinv(N - 1 - i)) % MOD

ans = 0
for i in range(N - 1):
    ans += Acc[i] * prob[i]
    ans %= MOD
print(ans)
