import random
N = int(input())
X = list(map(int, input().split()))
result, sum = 0, 0
for i in range(N-1):
  x = random.choice(X[:-1])
  sum += (X[-1]-x)
  result += (sum)*(1/(N-1))
  X.remove(x)

import math
val = math.factorial(N-1)

print((result*val)%1000000007)