n = int(input())
x = [int(i) for i in input().split()]
mod = 1000000007

fact = [1]*(n+1)
for i in range(1,n+1):
    fact[i] = (fact[i-1]*i)%mod
inv = [1]*(n+1)
inv[n] = pow(fact[n],mod-2,mod)
for i in range(n-1,1,-1):
    inv[i] = (inv[i+1]*(i+1))%mod

l = 0
ans = 0
for i in range(n-2):
    l = (l+x[n-2-i]-x[i])%mod
    f = (fact[n-1]*fact[i]*inv[i+2])%mod
    ans = (ans+l*f)%mod
for i in range(n-1):
    l = (x[n-1]-x[n-2-i])%mod
    ans = (ans+((fact[n-1]*fact[i]%mod)*inv[i+1]%mod)*l%mod)%mod
print(ans)