import math
N = int(input())
x = list(map(int, input().split()))
kyori = [x[i + 1] - x[i] for i in range(N - 1)]
MOD = 10 ** 9 + 7
kai = [0] * (N + 1)
kai[0] = 1
for i in range(1, N + 1):
    kai[i] = (kai[i - 1] * i) % MOD

kitai = 0
for i in range(2, N + 1):
    kitai += (((i * (i - 1)) // 2) / (i - 1)) * kyori[i - 2]

print(int((kitai * kai[N - 1]) % MOD))