import math

n = int(input())
li = list(map(int, input().split()))
last = li[-1]
wa = 0
x = 10**9+7
for i in range(n-1):
  temp = i
  if i == 0:
    wa += abs(li[i] - last)
  else:
    while temp >= 0:
      wa += abs(li[temp] - last)
      temp -= 1
      
print(int(((wa / (n-1)) % x) * math.factorial(n-1)))