class comb():
  F = [1, 1]
  Fi = [1, 1]
  I = [0, 1]
  def __init__(self, num, mod):
    self.MOD = mod
    for i in range(2, num + 1):
      self.F.append((self.F[-1] * i) % mod)
      self.I.append(mod - self.I[mod % i] * (mod // i) % mod)
      self.Fi.append(self.Fi[-1] * self.I[i] % mod)
  def com(self, n, k):
    if n < k: return 0
    if n < 0 or k < 0: return 0
    return self.F[n] * (self.Fi[k] * self.Fi[n - k] % self.MOD) % self.MOD


N = int(input())
x = list(map(int, input().split()))
MOD = 10 ** 9 + 7


ans = 0
k = 1
for i in range(1, N):
  k = k * i % MOD

com = comb(N, MOD)

t = 0
for i in range(1, N):
  t = (t + k * com.I[i]) % MOD
  ans = (ans + (x[i] - x[i - 1]) * t) % MOD

print(ans)