import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5)

N = int(input())
x = [int(i) for i in input().split()]

mod = 10 ** 9 + 7

fac = [1]
inv = [1]
for i in range(1, N + 30) :
  fac.append(fac[-1] * i % mod)
  inv.append(pow(fac[-1], mod - 2, mod))
  
a = [fac[N-1] * inv[i+1] % mod for i in range(N + 20)]
b = [fac[N-1] * inv[i+3] * fac[i+1] % mod for i in range(N + 20)]

for i in range(1, N + 10) :
  a[i] += a[i-1]
  b[i] += b[i-1]

ret = 0
for i in range(N - 1) :
  s = a[i]
  if i >= 2 :
    s += b[i-2]
  ret += (x[i+1] - x[i]) * s % mod
  ret %= mod
  
print(ret)