import sys

sys.setrecursionlimit(10**6)





def mod_inverse(n, mod=10**9+7):

    return pow(n, mod-2, mod)





def combination(n, k, mod=10**9+7):

    numer = denom = 1

    for i in range(k):

        numer = (numer * (n-i)) % mod

        denom = (denom * (i+1)) % mod

    return (numer * mod_inverse(denom, mod)) % mod





def factorial(n):

    if n == 0:

        return 1

    return n * factorial(n-1) % mod





mod = 10**9+7

N = int(eval(input()))

x = [0] + list(map(int, input().split()))

fact = factorial(N-1)



ans = 0

for k in range(2, N):

    ans = (ans + x[k] * (1 - mod_inverse(k)))



for k in range(1, N-1):

    ans = (ans - x[k] * (1 - mod_inverse(N-k))) % mod



ans = ans * fact % mod



ans = (ans + fact * sum((x[N] - x[k]) * mod_inverse(N-k) for k in range(1, N))) % mod



print(ans)

from math import factorial



mod = 10**9+7

N = int(eval(input()))

x = [0] + list(map(int, input().split()))

ans = 0

inv = [0] + [pow(i, mod-2, mod) for i in range(1, N)]



for k in range(2, N):

    ans = (ans + x[k] * (1 - inv[k])) % mod



for k in range(1, N-1):

    ans = (ans - x[k] * (1 - inv[N-k])) % mod



for k in range(1, N):

    ans = (ans + (x[N] - x[k]) * inv[N-k]) % mod



ans = ans * factorial(N-1) % mod



print(ans)

import sys

sys.setrecursionlimit(10**6)


def mod_inverse(n, mod=10**9 + 7):
    return pow(n, mod - 2, mod)


def combination(n, k, mod=10**9 + 7):
    numer = denom = 1
    for i in range(k):
        numer = (numer * (n - i)) % mod
        denom = (denom * (i + 1)) % mod
    return (numer * mod_inverse(denom, mod)) % mod


def factorial(n):
    if n == 0:
        return 1
    return n * factorial(n - 1) % mod


mod = 10**9 + 7
N = int(eval(input()))
x = [0] + list(map(int, input().split()))
fact = factorial(N - 1)
ans = 0
for k in range(2, N):
    ans = ans + x[k] * (1 - mod_inverse(k))
for k in range(1, N - 1):
    ans = (ans - x[k] * (1 - mod_inverse(N - k))) % mod
ans = ans * fact % mod
ans = (ans + fact * sum((x[N] - x[k]) * mod_inverse(N - k) for k in range(1, N))) % mod
print(ans)

from math import factorial

mod = 10**9 + 7
N = int(eval(input()))
x = [0] + list(map(int, input().split()))
ans = 0
inv = [0] + [pow(i, mod - 2, mod) for i in range(1, N)]
for k in range(2, N):
    ans = (ans + x[k] * (1 - inv[k])) % mod
for k in range(1, N - 1):
    ans = (ans - x[k] * (1 - inv[N - k])) % mod
for k in range(1, N):
    ans = (ans + (x[N] - x[k]) * inv[N - k]) % mod
ans = ans * factorial(N - 1) % mod
print(ans)

-import sys - -sys.setrecursionlimit(10**6) - - -def mod_inverse(n, mod=10**9 + 7): -    return pow(n, mod - 2, mod) - - -def combination(n, k, mod=10**9 + 7): -    numer = denom = 1 -    for i in range(k): -        numer = (numer * (n - i)) % mod -        denom = (denom * (i + 1)) % mod -    return (numer * mod_inverse(denom, mod)) % mod - - -def factorial(n): -    if n == 0: -        return 1 -    return n * factorial(n - 1) % mod - +from math import factorial -fact = factorial(N - 1) +inv = [0] + [pow(i, mod - 2, mod) for i in range(1, N)] -    ans = ans + x[k] * (1 - mod_inverse(k)) +    ans = (ans + x[k] * (1 - inv[k])) % mod -    ans = (ans - x[k] * (1 - mod_inverse(N - k))) % mod -ans = ans * fact % mod -ans = (ans + fact * sum((x[N] - x[k]) * mod_inverse(N - k) for k in range(1, N))) % mod +    ans = (ans - x[k] * (1 - inv[N - k])) % mod +for k in range(1, N): +    ans = (ans + (x[N] - x[k]) * inv[N - k]) % mod +ans = ans * factorial(N - 1) % mod