n = int(input())
x = list(map(int, input().split()))

MOD = 10 ** 9 + 7

class ModInv:
    def __init__(self, size, MOD):
        self.inv = [0] * (size + 1)
        self.inv[1] = 1
        for i in range(2, size + 1):
            self.inv[i] = (-(MOD // i) * self.inv[MOD%i]) % MOD

inv = ModInv(n, MOD)

#print(inv.inv)

b = 1
for i in range(1, n):
    b = (b * i) % MOD

ans = 0
temp = 0
for i in range(1, n):
    temp += inv.inv[i]
    ans += (x[i] - x[i-1]) * temp
    ans %= MOD

print((ans * b) % MOD)