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

l1 = [1]*N
for i in range(1, N):
    l1[i] = (l1[i-1]*i)%MOD

va, vb = 0, 1
ans = 0

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


print(ans)
