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

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