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

d = [x[i+1] - x[i] for i in range(n-1)]
ans = 0
mod = 10 **9 + 7
fac = 1
for i in range(1, n):
    fac *= i
    fac %= mod

tmp = 0
for i in range(n-1):
    tmp += fac * pow(i+1, mod-2, mod)
    tmp %= mod

    ans += d[i] * tmp
    ans %= mod

print(ans)