n=int(input())
x=list(map(int, input().split()))
mod = 10**9+7
last=x[-1]
X=[]
for i in x[:-1]:
  X.append(last-i)
l=1
left=[1]
for i in range(1, n-1):
  l=l*i%mod
  left.append(l)
r=1
right=[1]
for i in range(n-1, 1, -1):
  r*=i%mod
  right.append(r)
right.reverse()
flst=[]
for i,j in zip(left,right):
  flst.append((i*j)%mod)
s=0
for i,j in zip(X,flst):
  s+=i*j%mod
print(s%mod)