MOD = 10**9+7

N = int(input())
X = list(map(int,input().split()))

F = [0 for _ in range(N+1)]
F[0] = 1

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

ans = 0
tmp = 0

for i in range(N-1):
    ans += (tmp*(N-1-i)+(X[-1]-X[i])*F[i])*F[N-2-i]
    ans %= MOD
    tmp = tmp*(N-1-i)+(X[-1]-X[i])*F[i+1]
    tmp %= MOD

print(ans)