N, *X = map(int, open(0).read().split())

MOD = 10 ** 9 + 7

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

fact_list = [fact]
for i in range(2, N):
    fact_list.append(fact_list[-1] + fact * pow(i, MOD - 2, MOD) % MOD)

ans = 0
for i in range(N - 1):
    ans = (ans + (X[i + 1] - X[i]) * fact_list[i]) % MOD
    
print(ans % MOD)
