import math
N = int(input())
X = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0

count_max = math.factorial(N-1)
L = [[count_max]]

for i in reversed(range(1, N+1)):
  l = []
  for j in range(1,i+1):
    ans += (X[i-1]-X[j-1]) * count_max * (1/j - 1/i)
    
ans %= MOD
print(int(ans))

