mod = 10**9+7
N = int(input())
x = list(map(int,input().split()))
fact = [1]*(N+1)
for i in range(N):
    fact[i+1] = (i+1)*fact[i]
    fact[i+1] %= mod
inv = [1]*(N+1)
for i in range(N):
    inv[i] = pow(i,mod-2,mod)

x1 = []
for m in range(1,N-1):
    x1.append(x[m]*m*inv[m+1]%mod)
x2 = []
for n in range(N-2):
    x2.append(x[n]*(N-n-2)*inv[N-n-1]%mod)
x3 = []
for n in range(N-1):
    x3.append((x[N-1]-x[n])*inv[N-n-1])
ans = fact[N-1]*(sum(x1)-sum(x2)+sum(x3))
ans %= mod
print(ans)