import math

def kaijo(n):
    return math.factorial(n)

INF = 10 ** 9 + 7
N = int(input())
x = list(map(int, input().split()))
k = kaijo(N - 1)
tmp = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        tmp += ((x[j] - x[i]) / (N - 1 - j + 1)) % INF
    tmp += ((x[-1] - x[i]) / 2) % INF
tmp += ((x[-1] - x[-2])) % INF
ans = int(tmp * k)
ans %= INF
print(ans)