def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return [w[0],w[1]]
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m
    
n=int(input())
x=list(map(int,input().split()))
mod=10**9+7
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]*=mod_inv((i+1),mod)
  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)