MOD=10**9+7

N=int(input())
xlist=list(map(int,input().split()))

fact_nm1=1
for i in range(1,N):
  fact_nm1*=i
  fact_nm1%=MOD
#print(fact_nm1)

answer=0
for i in range(N-1):
  for j in range(i+1,N-1):
    ji_inv=pow(j-i,MOD-2,MOD)
    ji1_inv=pow(j-i+1,MOD-2,MOD)
    term=(fact_nm1*ji_inv*ji1_inv)%MOD
    answer+=term*(xlist[j]-xlist[i])
    answer%=MOD    
    #print(i,j,term)
  
  ni_inv=pow(N-1-i,MOD-2,MOD)
  term=(fact_nm1*ni_inv)%MOD
  answer+=term*(xlist[N-1]-xlist[i])
  answer%=MOD
  #print(i,N-1,term)
  
print(answer)