n = int(input())
x = list(map(int, input().split()))
mod = 10 ** 9 + 7

inv_t = [0] + [1]
for i in range(2, n):
    inv_t += [inv_t[mod % i] * (mod - int(mod / i)) % mod]


fact = [1] * (n+1)
for i in range(1, n + 1):
    fact[i] = (fact[i - 1] * i) % mod

ans = 0
for i in range(n-1):
    for j in range(i + 1, n-1):
        ans += ((x[j] - x[i]) * fact[n - 1] * inv_t[j - i + 1] * inv_t[j - i]) % mod
    ans += (x[n-1] - x[i]) * fact[n - 1] * inv_t[n-i-1]
    ans %= mod

print(ans%mod)