import numpy as np

N = int(input())
X = list(map(int, input().split()))
mod = 10**9 + 7
  
bl = []
for i in range(len(X) - 1):
  b = X[i+1] - X[i]
  bl.append(b)

C = []
for i in range(1, len(X)):
  c = 0
  for j in range(i):
    c = c + 1/(j+1)
  C.append(c)
B = [b*c for b,c in zip(bl,C)]
B = np.sum(B)

Nk = 1
for i in range(1,N):
  Nk = Nk * i
a = (B * Nk) % mod
print(int(a))