mod = 10**9 + 7
n = int(input())
lx = list(map(int, input().split()))

from math import factorial as kj

d = 0
lk = [0] * n

for i in range(1, n):
  d += kj(n-1) // i % mod
  lk[i] = (lx[i] - lx[i-1]) * d % mod

print(sum(lk) % mod)