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

mod = 10**9 + 7

fac = [1, 1]
inv = [1, 1]
finv = [1, 1]
for i in range(2, n+5):
    fac.append(fac[i-1] * i % mod)
    inv.append(mod - inv[mod%i] * (mod//i) % mod)
    finv.append(finv[i-1] * inv[i] % mod)

ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        if j == n-1:
            ans += inv[n-1-i] * (x[j] - x[i]) % mod * fac[n-1] % mod
        else:
            ans += (inv[j-i] - inv[j-i+1]) * (x[j] - x[i]) % mod * fac[n-1] % mod
        ans %= mod

print(ans)
