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

f = 1
for i in range(1,N):
  f *= i
  f %= MOD
#print(f)

c = [1 for _ in range(N)]
for i in range(1,N):
  c[i] = c[i-1] + pow(i+1,MOD-2,MOD) # 1/(i+1)を加算
  c[i] %= MOD

ans = 0
for i in range(N-1):
  ans += (X[i+1]-X[i])*c[i]
  ans %= MOD
print((ans*f)%MOD)
