N = int(input())
x = [int(i) for i in input().split()]
mod = 10 ** 9 + 7

fac = 1

for i in range(2, N) :
  fac = fac * i % mod

inv_sum = [pow(i, mod - 2, mod) for i in range(1, N)]
for i in range(1, N - 1) :
  inv_sum[i] += inv_sum[i-1]

ret = 0
for i in range(N - 1) :
  d = x[i + 1] - x[i]
  ret += d * inv_sum[i] % mod
  ret %= mod

print(ret * fac % mod)