mod = 10**9+7

N = int(eval(input()))

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

fact = [1]*(N+1)

for i in range(N):

    fact[i+1] = (i+1)*fact[i]

    fact[i+1] %= mod

inv = [1]*(N+1)

for i in range(N):

    inv[i] = pow(i,mod-2,mod)



x1 = []

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

    x1.append(x[m]*m*inv[m+1]%mod)

x2 = []

for n in range(N-2):

    x2.append(x[n]*(N-n-2)*inv[N-n-1]%mod)

x3 = []

for n in range(N-1):

    x3.append((x[N-1]-x[n])*inv[N-n-1])

ans = fact[N-1]*(sum(x1)-sum(x2)+sum(x3))

ans %= mod

print(ans)
mod = 10**9+7

N = int(eval(input()))

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



ans = 0

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

    ans += x[j]*j*pow(j+1,mod-2,mod)

    ans %= mod

for i in range(N-2):

    ans += x[i]*(-N+i+2)*pow(N-i-1,mod-2,mod)

    ans %= mod

for i in range(N-1):

    ans += (x[N-1]-x[i])*pow(N-1-i,mod-2,mod)

    ans %= mod



for i in range(1,N):

    ans *= i

    ans %= mod



print(ans)
mod = 10**9 + 7
N = int(eval(input()))
x = list(map(int, input().split()))
fact = [1] * (N + 1)
for i in range(N):
    fact[i + 1] = (i + 1) * fact[i]
    fact[i + 1] %= mod
inv = [1] * (N + 1)
for i in range(N):
    inv[i] = pow(i, mod - 2, mod)
x1 = []
for m in range(1, N - 1):
    x1.append(x[m] * m * inv[m + 1] % mod)
x2 = []
for n in range(N - 2):
    x2.append(x[n] * (N - n - 2) * inv[N - n - 1] % mod)
x3 = []
for n in range(N - 1):
    x3.append((x[N - 1] - x[n]) * inv[N - n - 1])
ans = fact[N - 1] * (sum(x1) - sum(x2) + sum(x3))
ans %= mod
print(ans)

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

-fact = [1] * (N + 1) -for i in range(N): -    fact[i + 1] = (i + 1) * fact[i] -    fact[i + 1] %= mod -inv = [1] * (N + 1) -for i in range(N): -    inv[i] = pow(i, mod - 2, mod) -x1 = [] -for m in range(1, N - 1): -    x1.append(x[m] * m * inv[m + 1] % mod) -x2 = [] -for n in range(N - 2): -    x2.append(x[n] * (N - n - 2) * inv[N - n - 1] % mod) -x3 = [] -for n in range(N - 1): -    x3.append((x[N - 1] - x[n]) * inv[N - n - 1]) -ans = fact[N - 1] * (sum(x1) - sum(x2) + sum(x3)) -ans %= mod +ans = 0 +for j in range(1, N - 1): +    ans += x[j] * j * pow(j + 1, mod - 2, mod) +    ans %= mod +for i in range(N - 2): +    ans += x[i] * (-N + i + 2) * pow(N - i - 1, mod - 2, mod) +    ans %= mod +for i in range(N - 1): +    ans += (x[N - 1] - x[i]) * pow(N - 1 - i, mod - 2, mod) +    ans %= mod +for i in range(1, N): +    ans *= i +    ans %= mod