MOD=10**9+7
N=int(input())
xlist=list(map(int,input().split()))

inv_table = [0]+[1]
for i in range(2,N+1):
  inv_table.append(-(MOD//i)*inv_table[MOD%i]%MOD)

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=inv_table[j-i]
    ji1_inv=inv_table[j-i+1]
    term=(ji_inv*ji1_inv)%MOD
    answer+=term*(xlist[j]-xlist[i])
    answer%=MOD
    #print(i,j,term)
  
  ni_inv=inv_table[N-1-i]
  term=ni_inv%MOD
  answer+=term*(xlist[N-1]-xlist[i])
  answer%=MOD
  #print(i,N-1,term)
  
answer*=fact_nm1
answer%=MOD  
print(answer)