import math

MOD = 10**9 + 7
N = int(input())
x = [int(i) for i in input().split()]
x.reverse()
f_n_1 = math.factorial(N - 1)

ans = 0
for i, x_i in enumerate(x):
    if i == 0:
        continue
    tmp = 0
    for j in range(i):
        diff = x[j] - x_i
        tmp += diff
    tmp = tmp * f_n_1 / i
    ans += tmp
    ans %= MOD

ans = int(ans)
print(ans)
