mod=10**9+7
n=10**5+100
inv=[0]*(n+1)
inv[1]=1
for i in range(2,n+1):
    inv[i]=-(mod//i)*inv[mod%i]%mod
for i in range(1,n+1):
    inv[i]=(inv[i]+inv[i-1])%mod
N=int(input())
X=[0]+list(map(int,input().split()))
data=[1,1]
for i in range(2,N+1):
    data.append(data[-1]*i%mod)
ans=X[2]-X[1]
for k in range(2,N):
    ans=(k*ans%mod+data[k]*inv[k]*(X[k+1]-X[k])%mod)%mod
print(ans)    