N=int(input())
X=list(map(int,input().split()))
Y=[X[i+1]-X[i] for i in range(N-1)]
m=10**9+7
a,b=0,0
for i,y in enumerate(Y):
    b=(b+pow(i+1,m-2,m))%m
    a=(a+b*y)%m
f=1
for n in range(2,N):
    f=(f*n)%m
print(a*f%m)