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

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)%mo)
    kai = kai%mo 
kai = kai%mo 

das = []
for i in range(n-1):
    das.append(int(kai/(i+1)))

das_rui = []
hog = 0
for i in range(n-1):
    hog += das[i]
    hog = hog%mo
    das_rui.append(hog)


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):
    fa = ( (das_rui[i]%mo)*(d[i]%mo) )%mo
    ans += fa
    ans = ans%mo

print(ans%mo)

