n = int(input())
x = list(map(int,input().split()))

P = 10**9 + 7
mo = P
inv_t = [0]+[1]
for i in range(2,n):
  inv_t += [inv_t[P % i] * (P - int(P / i)) % P]


d = []
for i in range(n-1):
    d.append(x[i+1] - x[i])

kai = 1
for i in range(n-2):
    kai = kai*(i+2)
    kai = kai%mo 

rui = []
tmp = 0
for i in range(n-1):
    tmp += d[-i-1]
    tmp = tmp%mo
    rui.append(tmp)

#print(d)
#print(kai)
#print(rui)

ans = 0
for i in range(n-1):
    #print(kai/(n-i-1))
    fa = kai*inv_t[n-i-1]
    fa = ( (fa%mo)*(rui[i]%mo) )%mo
    ans += fa
    ans = ans%mo

print(ans%mo)

