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)
    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//(n-i-1)
    fa = (fa*rui[i])%mo
    ans += fa

print(ans%mo)