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

ans=0
for i in range(0,N-1):
    ans+=pow(i+1,mod-2,mod)*(x[-1]-x[i])
    ans%=mod

for i in range(1,N):
    ans*=i
    ans%=mod
print(ans)
