import math
import numpy as np

N = int(input())
# スペース区切りの整数の入力
x = np.array(input().rstrip().split(" ")).astype(np.uint64)

out = 0

N_kai = math.factorial(N - 1)
for i in range(N - 1):
    x_i = (x[i + 1 :] - x[i])[::-1]
    exp = 1 / (np.arange(2, N + 1 - i) * np.arange(1, N - i))
    exp[N - 2 - i] = 1 / (N - 1 - i)
    out = out + np.sum(exp * x_i)
    out = out % (10 ** 9 + 7)

print(int(out * N_kai % (10 ** 9 + 7)))