import numpy as np

MOD=10**9+7
N=int(input())
x=list(map(int, input().split()))
y=np.array([x[i+1]-x[i] for i in range(N-1)])

upp=[1]*(N+1)
for i in range(2, N+1):
  upp[i]=upp[i-1]*i
  upp[i]%=MOD
  
inv=[1]*(N+1)
inv[-1]=pow(upp[-1], MOD-2, MOD)
for i in range(N, 1, -1):
  inv[i-1]=inv[i]*(i)

a=[0]*(N-1)
a[0]=upp[N-1]
for i in range(1, N-1):
  a[i]=a[0]//(i+1)
  
a=np.array(a)
a%=MOD

ex=np.dot(a, y)
for i in range(1, N-1):
  ex+=np.dot(a[:-i], y[i:])
  ex%=MOD
  
print(ex)