N = int(input())
X = list(map(int,input().split()))
ans = 0
mod = 10**9+7
l=[1]*(N+1)
a=1
for i in range(2,N+1):
  a*=i
  a%=mod
  l[i]=a
x=X[-1]
for i in range(N-1):
  for j in range(i+1,N-1):
    a = j-i-1
    ans += (X[j]-X[i])*(l[a])%mod*l[N-1]%mod*pow(l[a+2],mod-2,mod)%mod
    
for k,y in enumerate(X[:N-1:]):
  a = N-k-2
  ans+=(x-y)*l[a]%mod*l[N-1]%mod*pow(l[a+1],mod-2,mod)%mod
print(ans%mod)