N = int(input())
*x, = map(int, input().split())
MOD = 10**9+7

m = 1
for i in range(1, N):
    m *= i
    m %= MOD

va, vb = 0, 1
ans = 0

for i in range(N-1):
    d = x[i+1]-x[i]
    va = ((i+1)*va+vb)%MOD
    vb = ((i+1)*vb)%MOD
    ans += (d*va*pow(vb, MOD-2, MOD)*m)
    ans %= MOD

print(ans)
