import math

n = int(input())
positionList = list(map(int, input().split()))

MOD = 10 ** 9 + 7

diffList = [0] * (n - 1)
for i, position in enumerate(positionList):
  if i == 0:
    continue
  diffList[i - 1] = position - positionList[i - 1]

weightList = [0] * (n - 1)
for i in range(n - 1):
  for j in range(n - i - 1):
    weightList[i + j] += int(math.factorial(n - 1) / (i + 1))

result = 0
for i in range(n - 1):
  result = (result + diffList[i] * weightList[i]) % MOD
print(result)