#!/usr/bin/env python3
import sys
input = sys.stdin.readline
MOD = 10**9 + 7

n = int(input())
x = [int(item) for item in input().split()]
inv = [0] * (n + 10)

n_minus_1_fac = 1
for i in range(1, n):
    n_minus_1_fac *= i
    n_minus_1_fac %= MOD 

for i in range(n + 10):
    inv[i] = pow(i, MOD-2, MOD)
inv_cumsum = [0] * (n + 10)
for i in range(1, n + 10):
    inv_cumsum[i] = (inv_cumsum[i-1] + inv[i]) % MOD

ans = 0
for i, (x1, x2) in enumerate(zip(x, x[1:])):
    ans += (x2 - x1) * inv_cumsum[i+1] * n_minus_1_fac % MOD
    ans %= MOD
print(ans)