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

fact = [1]*(N+1)
rfact = [1]*(N+1)
r = 1
for i in range(1, N+1):
  fact[i] = r = r * i % MOD
rfact[N] = r = pow(fact[N], MOD-2, MOD)
for i in range(N, 0, -1):
  rfact[i-1] = r = r * i % MOD

ret = 0
inverse = 0
for i in range(1, N):
    diff = X[i] - X[i-1]
    inverse += rfact[i]
    ret += diff * inverse
    ret %= MOD

print(ret*fact[N-1]%MOD)
