import math
import copy
import random

N = int(input())
x_true = list(map(int, input().split()))
test = 10**4
tes = 0

for k in range(test):
  distance = 0
  x = copy.deepcopy(x_true)

  for i in range(1, N):
    pos = random.randint(1, N-i) -1
    a = x.pop(pos)
    distance += x[pos]-a
  
  tes += distance
  distance = 0
  
print(int((round(tes/test, 1) * math.factorial(N-1))%(10**9+7)))