n=int(input())
x=list(map(int,input().split()))
mod=10**9+7
inv=[0,1]
for i in range(2,n+1):
  inv+=[inv[mod%i]*(mod-int(mod/i))%mod]
l=[]
z=1
for i in range(1,n):
  z*=i
  z%=mod
l2=[z for i in range(n-1)]
for i in range(n-1):
  l.append(x[i+1]-x[i])
for i in range(n-1):
  l2[i]*=inv[i+1]
  l2[i]%=mod
l3=[]
l3.append(l2[0])
for i in range(n-2):
  l3.append(l3[-1]+l2[i+1])
ans=0
for i in range(n-1):
  ans+=l3[i]*l[i]
  ans%=mod
print(ans)