N = int(input())
x = list(map(int, input().split()))
MOD = 10**9+7
D = x[-1]-x[0]
ans = 0
fact = [1]

for i in range(1, N):
    fact.append(fact[-1]*i%MOD)

inv_table = [-1]*N

for i in range(N):
    inv_table[i] = pow(i, MOD-2, MOD)
    
for i in range(N-1):
    d = D-(x[i]-x[0])
    ans += d*fact[N-1]*inv_table[i+1]
    ans %= MOD

print(ans)