N = int(input())
x = list(map(int, input().split()))
import itertools
import numpy as np
mod = 10**9+7
Y = 0
Z = 0
n = 1

x = np.array(x)
w = np.diff(x)

A = len(list(itertools.permutations(w)))
for i in w:
    Y += A/n % mod
    Z += Y * i % mod
    n += 1
print(int(Z))