n = int(input())
x = list(map(int,input().split()))
mod = 10**9+7


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

#p:倍率
#q:倍率積
p = []
q = 1
last = 1
fac = 1

for i in range(2,n):
    last = (last*i+fac)%mod
    fac = fac*i%mod
    p.append(last*pow(fac*q,mod-2,mod)%mod)
    q = q*p[-1]%mod


res = 0
r = fac
for i in range(n-1):
    res = (res + y[i]*r)%mod
    if i != n-2:
        r = (r*p[i])%mod
print(res%mod)
