mod=1000000007
n=int(input())
X=list(map(int,input().split()))
L=[]
for  i in range(n-1):
    L.append(X[i+1]-X[i])
for i in range(n-2,0,-1):
    L[i-1]=(L[i-1]+L[i])%mod
l=[1]
for i in range(n-1):
    l.append(l[-1]*(i+1)%mod)
ll=[1]
for i in range(n-1,0,-1):
    ll.append(ll[-1]*i%mod)
ans=0
for i in range(n-1):
    ans=(ans+((L[i]*l[i])%mod)*ll[n-2-i])%mod
print(ans)