MOD = 10**9+7
n = int(input())
m = n - 1
x = list(map(int, input().split()))
d = [x[i+1] - x[i] for i in range(m)]

s = 1
for i in range(2, n):
    s *= i
ans = sum(d) * s % MOD

for i in range(m):
    p = 1
    for j in range(i+1, n-1):
        c = j - i
        p *= c / (c+1)
        ans += d[j] * int(p * s)
        ans %= MOD

print(int(ans))
