MOD=10**9+7
N=int(input())
x=list(map(int, input().split()))
y=[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
  
N_1=N-1
b=[0]*(N_1)
b[0]=upp[N_1]
tmp=upp[N_1]
for i in range(1, N_1):
  a=tmp*pow(i+1, MOD-2, MOD)%MOD
  b[i]=(b[i-1]+a)%MOD


print(sum([b[i]*y[i]%MOD for i in range(N_1)])%MOD)