N = int(eval(input()))

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

mod = 10**9 + 7

def mul(a, b):

    return ((a % mod) * (b % mod)) % mod

NNN = (10**6)

g1 = [1, 1]

inverse = [0, 1]

for i in range( 2, NNN + 1 ):

    g1.append( ( g1[-1] * i ) % mod )

    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )



mxx = Xs[-1]

r = 0

r2 = 0

for i in range(N-1):

    r = (r+mul(mul(g1[N-1],inverse[i+1]),Xs[N-1]-Xs[i]))%mod

print(r)

N,*X=list(map(int,open(0).read().split()))

M,g,q,r=10**9+7,1,[1,1],0

for i in range(1,N):

 r,g=(r+q[-1]*(X[-1]-X[i-1]))%M,g*i%M

 q+=[M//(-~i)*-q[M%(-~i)]%M]

print((r*g%M))
N = int(eval(input()))
Xs = list(map(int, input().split()))
mod = 10**9 + 7


def mul(a, b):
    return ((a % mod) * (b % mod)) % mod


NNN = 10**6
g1 = [1, 1]
inverse = [0, 1]
for i in range(2, NNN + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod // i)) % mod)
mxx = Xs[-1]
r = 0
r2 = 0
for i in range(N - 1):
    r = (r + mul(mul(g1[N - 1], inverse[i + 1]), Xs[N - 1] - Xs[i])) % mod
print(r)

N, *X = list(map(int, open(0).read().split()))
M, g, q, r = 10**9 + 7, 1, [1, 1], 0
for i in range(1, N):
    r, g = (r + q[-1] * (X[-1] - X[i - 1])) % M, g * i % M
    q += [M // (-~i) * -q[M % (-~i)] % M]
print((r * g % M))

-N = int(eval(input())) -Xs = list(map(int, input().split())) -mod = 10**9 + 7 - - -def mul(a, b): -    return ((a % mod) * (b % mod)) % mod - - -NNN = 10**6 -g1 = [1, 1] -inverse = [0, 1] -for i in range(2, NNN + 1): -    g1.append((g1[-1] * i) % mod) -    inverse.append((-inverse[mod % i] * (mod // i)) % mod) -mxx = Xs[-1] -r = 0 -r2 = 0 -for i in range(N - 1): -    r = (r + mul(mul(g1[N - 1], inverse[i + 1]), Xs[N - 1] - Xs[i])) % mod -print(r) +N, *X = list(map(int, open(0).read().split())) +M, g, q, r = 10**9 + 7, 1, [1, 1], 0 +for i in range(1, N): +    r, g = (r + q[-1] * (X[-1] - X[i - 1])) % M, g * i % M +    q += [M // (-~i) * -q[M % (-~i)] % M] +print((r * g % M))